public int Reduce(GlobalTableKey gkey, int state) { try { Reduce reduce = ReduceWaitLater(gkey, state); if (null != reduce) { reduce.Future.Task.Wait(); // 如果rpc返回错误的值,外面能处理。 return(reduce.Result.State); } return(GlobalCacheManager.StateReduceNetError); } catch (RpcTimeoutException timeoutex) { // 等待超时,应该报告错误。 logger.Error(timeoutex, "Reduce RpcTimeoutException {0} target={1}", state, SessionId); return(GlobalCacheManager.StateReduceRpcTimeout); } catch (Exception ex) { logger.Error(ex, "Reduce Exception {0} target={1}", state, SessionId); return(GlobalCacheManager.StateReduceException); } }
/// <summary> /// 返回null表示发生了网络错误,或者应用服务器已经关闭。 /// </summary> /// <param name="gkey"></param> /// <param name="state"></param> /// <returns></returns> public Reduce ReduceWaitLater(GlobalTableKey gkey, int state) { try { lock (this) { if (global::Zeze.Util.Time.NowUnixMillis - LastErrorTime < ForbitPeriod) { return(null); } } AsyncSocket peer = GlobalCacheManager.Instance.Server.GetSocket(SessionId); if (null != peer) { Reduce reduce = new Reduce(gkey, state); reduce.SendForWait(peer, 10000); return(reduce); } } catch (Exception ex) { // 这里的异常只应该是网络发送异常。 logger.Error(ex, "ReduceWaitLater Exception {0}", gkey); } SetError(); return(null); }
public static IEnumerable <KeyValuePair <TOK, TOV> > Run <TIK, TIV, TTK, TTV, TOK, TOV>( Map <TIK, TIV, TTK, TTV> map, Reduce <TTK, TTV, TOK, TOV> reduce, IEnumerable <KeyValuePair <TIK, TIV> > input) { // // Map and group all at once // var tempStorage = new Dictionary <TTK, List <TTV> >(); foreach (var inputPair in input) { foreach (var tempPair in map(inputPair.Key, inputPair.Value)) { List <TTV> vals; if (!tempStorage.TryGetValue(tempPair.Key, out vals)) { vals = new List <TTV>(); tempStorage.Add(tempPair.Key, vals); } vals.Add(tempPair.Value); } } // // Reduce // foreach (var tempPair in tempStorage) { foreach (var outPair in reduce(tempPair.Key, tempPair.Value)) { yield return(outPair); } } }
public void ReduceTestCase() { var parameters = new List <string>(); var partition1 = "[[\"a\", 1],[\"word\", 1],[\"and\", 1],[\"another\", 1],[\"word\", 1],[\"in\", 1],[\"a\", 1],[\"sentence\", 1]]"; var partition2 = "[[\"a\", 1],[\"word\", 1],[\"and\", 1],[\"another\", 1],[\"in\", 1],[\"a\", 1],[\"sentence\", 1]]"; parameters.Add(partition1); parameters.Add(partition2); var reduce = new Reduce(); reduce.SetInParameters(parameters); reduce.pHandler = null; // Disable the persistence handler reduce.Execute(); var result = reduce.Result as Dictionary <string, int>; Assert.True(result.ContainsKey("a")); Assert.AreEqual(4, result["a"]); Assert.True(result.ContainsKey("word")); Assert.AreEqual(3, result["word"]); Assert.True(result.ContainsKey("and")); Assert.AreEqual(2, result["and"]); Assert.True(result.ContainsKey("another")); Assert.AreEqual(2, result["another"]); Assert.True(result.ContainsKey("in")); Assert.AreEqual(2, result["in"]); Assert.True(result.ContainsKey("sentence")); Assert.AreEqual(2, result["sentence"]); // Something that doesn occurr Assert.False(result.ContainsKey("jesus")); }
private void ReducesSum() { var interceptor = new Reduce<int>("ValueMethod", SumFunc); var test = GetComposable(interceptor); Assert.Equal(15, test.ValueMethod()); }
public static Continuation ETag(this ICacheSteps _, Reduce<string> etagReducer) { return step => ctx => { var etag = etagReducer(ctx); // always sends the etag regardless wether the validator works or not if (!string.IsNullOrEmpty(etag)) step = fu.Http.Header("ETag", "\"" + etag + "\"")(step); // if the validator validates, send back a 304 Not Modified var ifNoneMatchHeader = ctx.Request.Headers["If-None-Match"]; if (!string.IsNullOrEmpty(ifNoneMatchHeader)) { // note that the Select part is lazy-evaluated var existingETags = ifNoneMatchHeader .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(h => h.Trim()) .Where(h => !string.IsNullOrEmpty(h) && h.Length > 2) .Select(h => h.Substring(1, h.Length - 2)); // check wether there's meat (!= null) to match a wildcard // or that wether the client have a representation with the same etag if ((ifNoneMatchHeader == "*" && !string.IsNullOrEmpty(etag)) || existingETags.Contains(etag)) { step = fu.Http.NotModified()(fu.EndAct); } } step(ctx); }; }
public Job(Map map, Reduce reduce, Failure failure, string logName) { _map = map; _reduce = reduce; _failure = failure; LOGNAME = logName; }
public void ShouldConvertToStringWithBullet() { Reduce predicate; predicate = new Reduce(); Assert.AreEqual("•;", predicate.ToString(predicate)); }
public void ShouldNotEquals() { Reduce <char> a, b; a = new Reduce <char>("A", true, new MockedReduceInput(), null); b = new Reduce <char>("B", true, new MockedReduceInput(), null); Assert.IsFalse(a.Equals(b)); Assert.IsFalse(b.Equals(a)); }
public static Continuation Custom(this IMapSteps _, ContDict mappings, Reduce<string> pathReducer, Continuation on404) { var dict = mappings.ToDictionary( kv => new Regex(kv.Key), kv => kv.Value); return _.Custom(dict, pathReducer, on404); }
public static Continuation Results(Reduce<IResult> resultReducer) { return step => ctx => { var result = resultReducer(ctx); var newCtx = new ResultContext(ctx, result); step(newCtx); }; }
public static Continuation If(Reduce<bool> predicate, Continuation trueCont, Continuation falseCont) { return step => ctx => { if (predicate(ctx)) trueCont(step)(ctx); else falseCont(step)(ctx); }; }
public override int GetHashCode() { unchecked { int result = (Map != null ? Map.GetHashCode() : 0); result = (result * 397) ^ (Reduce != null ? Reduce.GetHashCode() : 0); result = (result * 397) ^ (Stores != null ? Stores.GetHashCode() : 0); result = (result * 397) ^ (Indexes != null ? Indexes.GetHashCode() : 0); return(result); } }
protected internal override IEnumerable <object> ApplyReduceFunctionIfExists(IndexQuery indexQuery, IEnumerable <object> enumerable) { if (Reduce == null) { return(enumerable.Take(indexQuery.PageSize)); } var compile = Reduce.Compile(); return(compile(enumerable.Cast <TReduceResult>()).Cast <object>().Take(indexQuery.PageSize)); }
public void ShouldNotEquals() { Reduce a; a = new Reduce(); Assert.IsFalse(a.Equals(null)); Assert.IsFalse(a.Equals(new Terminal(new Token("C", "a")))); Assert.IsFalse(a.Equals(new AnyTerminal())); }
private void AddReductionsToState(State <T> State, ISituationCollection <T> Situations) { Reduce <T> reduce; foreach (Situation <T> situation in Situations.GetReductionSituations()) { reduce = new Reduce <T>(situation.Rule.Name, situation.Rule.IsAxiom, situation.Input, situation.Rule.Attributes); State.Add(reduce); } }
public void Itest() { var a = new add(); var text1 = a.Result(20, 10); var b = new Reduce(); var text2 = b.Result(20, 10); var c = new Ride(); var text3 = c.Result(20, 10); }
public static Continuation File(this IStaticSteps _, Reduce<string> filenameReducer, Filter<string> contentTypeFilter) { return step => ctx => { var filename = filenameReducer(ctx); var contentType = contentTypeFilter(ctx, filename); step(FileResult.From(ctx, filename, contentType)); }; }
public void ShouldEquals() { Reduce a, b; a = new Reduce(); b = new Reduce(); Assert.IsTrue(a.Equals(b)); Assert.IsTrue(b.Equals(a)); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { int result = Maps.Where(x => x != null).Aggregate(0, (acc, val) => acc * 397 ^ val.GetHashCode()); result = (result * 397) ^ Maps.Count; result = (result * 397) ^ (Reduce?.GetHashCode() ?? 0); result = (result * 397) ^ DictionaryHashCode(Fields); return(result); } }
public void ShoudAddReduce() { State <char> state; Reduce <char> action; action = new Reduce <char>("A", true, new MockedTerminalInput('a'), null); state = new State <char>(); state.Add(action); Assert.AreEqual(1, state.ReduceActionCount); Assert.IsTrue(state.ReduceActions.Contains(action)); }
public void ShoudNotGetReduceUsingTerminalInput() { State <char> state; IReduce <char> action; action = new Reduce <char>("A", true, new MockedTerminalInput('a'), null); state = new State <char>(); state.Add(action); action = state.GetReduce(new MockedTerminalInput('b')); Assert.IsNull(action); }
public void ShouldGetInputs() { Reduce predicate; IInput <Token>[] inputs; predicate = new Reduce(); inputs = predicate.GetInputs().ToArray(); Assert.IsNotNull(inputs); Assert.AreEqual(1, inputs.Length); Assert.IsInstanceOfType(inputs[0], typeof(EOSInput <Token>)); }
public void DirReduc_WithValidArray_ShouldReductToWest(params string[] instructions) { // Arrange var expected = "WEST"; var reduct = new Reduce(instructions); // Act var result = reduct.DirReduc(); // Assert Assert.Equal(expected, result); }
public void DirReduc_WithValidArray_ShouldNotBeReducible(params string[] instructions) { // Arrange var expected = string.Join(", ", instructions); var reduct = new Reduce(instructions); // Act var result = reduct.DirReduc(); // Assert Assert.Equal(expected, result); }
public IReduce <int> some_method_6(int arg1, int arg2, int arg3, IScatter <int> arg4, IScatter <int> arg5, IScatter <int> arg6) { MPI.RequestList reqList = new MPI.RequestList(); sendArguments(OPERATION_6, arg1, arg2, arg3, arg4, arg5, arg6, ref reqList); receiveResult <int> (ref reqList, OPERATION_6); IList <MPI.Request> reqList_complete = reqList.WaitAll(); int[] result_values = takeResults(reqList_complete); return(Reduce <int> .create(channel, result_values, sum, 0)); }
public void DirReduc_WithValidCaseSensitiveArray_ShouldReduct() { // Arrange var instructions = new[] { "north", "south", "east", "west", "west" }; var expected = "WEST"; var reduct = new Reduce(instructions); // Act var result = reduct.DirReduc(); // Assert Assert.Equal(expected, result); }
public void DirReduc_WithValidCaseSensitiveString_ShouldReduct() { // Arrange var instructions = "[North, South, South, East, West, North, West]"; var expected = "WEST"; var reduct = new Reduce(instructions); // Act var result = reduct.DirReduc(); // Assert Assert.Equal(expected, result); }
public void DirReduc_WithValidScapedString_ShouldReduct() { // Arrange var instructions = "[\"NORTH\", \"SOUTH\", \"SOUTH\", \"EAST\", \"WEST\", \"NORTH\", \"WEST\"]"; var expected = "WEST"; var reduct = new Reduce(instructions); // Act var result = reduct.DirReduc(); // Assert Assert.Equal(expected, result); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { int result = (Map != null ? Map.GetHashCode() : 0); result = (result * 397) ^ (Reduce != null ? Reduce.GetHashCode() : 0); result = (result * 397) ^ DictionaryHashCode(Stores); result = (result * 397) ^ DictionaryHashCode(Indexes); result = (result * 397) ^ DictionaryHashCode(Analyzers); result = (result * 397) ^ DictionaryHashCode(SortOptions); return(result); } }
public IEnumerable IndexingFunction(IEnumerable <dynamic> items) { try { EnsureGroupItemCreated(); foreach (DynamicBlittableJson item in items) { if (_groupedItems.TryGetValue(item.BlittableJson, out var list) == false) { list = new List <BlittableJsonReaderObject>(); _groupedItems[item.BlittableJson] = list; } list.Add(item.BlittableJson); } foreach (var item in _groupedItems.Values) { Engine.ResetCallStack(); Engine.ResetStatementsCount(); Engine.ResetTimeoutTicks(); _oneItemArray[0] = ConstructValues(item); JsValue jsItem = null; try { jsItem = Reduce.Call(JsValue.Null, _oneItemArray).AsObject(); } catch (JavaScriptException jse) { var(message, success) = JavaScriptIndexFuncException.PrepareErrorMessageForJavaScriptIndexFuncException(ReduceString, jse); if (success == false) { throw new JavaScriptIndexFuncException($"Failed to execute {ReduceString}", jse); } throw new JavaScriptIndexFuncException($"Failed to execute reduce script, {message}", jse); } catch (Exception e) { throw new JavaScriptIndexFuncException($"Failed to execute {ReduceString}", e); } yield return(jsItem); _resolver.ExplodeArgsOn(null, null); } } finally { _oneItemArray[0] = null; _groupedItems.Clear(); } }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { int result = Maps.Where(x => x != null).Aggregate(0, (acc, val) => acc * 397 ^ val.GetHashCode()); result = (result * 397) ^ Maps.Count; result = (result * 397) ^ (Reduce != null ? Reduce.GetHashCode() : 0); result = (result * 397) ^ DictionaryHashCode(Stores); result = (result * 397) ^ DictionaryHashCode(Indexes); result = (result * 397) ^ DictionaryHashCode(Analyzers); result = (result * 397) ^ DictionaryHashCode(SortOptions); return(result); } }
private static void _Main(string[] args) { // input "x = 2*(3+3)" ICharStream input; if (args.Length > 0) { if (args[0].Equals("-i")) { if (args.Length > 1) { input = new ANTLRFileStream(args[1]); } else { throw new Exception("No input file specified."); } } else { input = new ANTLRStringStream(args[0]); } } else { input = new ANTLRInputStream(Console.OpenStandardInput()); } var lex = new VecMathLexer(input); var tokens = new CommonTokenStream(lex); var g = new VecMathParser(tokens); IAstRuleReturnScope <CommonTree> r = g.prog(); CommonTree t = r.Tree; Console.WriteLine("Original tree: " + t.ToStringTree()); var simplify = new Simplify(new CommonTreeNodeStream(t)); t = (CommonTree)simplify.Downup(t); var reduce = new Reduce(new CommonTreeNodeStream(t)); t = (CommonTree)reduce.Downup(t); Console.WriteLine("Simplified tree: " + t.ToStringTree()); Console.ReadKey(); }
protected override void workProcessing() { Reduce = (Reduce)loadClientAssembly(AssemblyMetaData.ReduceClassName); var filesToProcess = WorkerConfig.WorkConfig.FilesToProcess; foreach (KeyValuePair <string, List <S3ObjectMetadata> > entry in filesToProcess) { LineReader lineReader = new LineReader(entry.Value); Reduce.setKey(entry.Key); Reduce.reduce(entry.Key, lineReader); lineReader.dispose(); } }
public override IBatch End() { IBatch batch = new MysqlBatch(); Tuple <List <String>, List <String> > tuple = ConvertHeader(Reduce.GetHeader()); Type t = typeof(T); StringBuilder sb = new StringBuilder(); TableRelevanceMapper table = Reduce.GetTable(); List <ColumnRelevanceMapper> wherecolumns = Reduce.GetWhere(); sb.Append(table.TableOperatorEnum.GetOperator()); sb.Append($" {EntityTableMapper.GetTableName(t)} "); switch (table.TableOperatorEnum) { case TableOperatorEnum.Insert: sb.Append(GetInsertSql(tuple)); break; case TableOperatorEnum.Update: sb.Append(" set "); sb.Append(GetUpdateSql(tuple)); if (wherecolumns.Count == 0) { SetNoneWhere(t); } break; case TableOperatorEnum.Delete: if (wherecolumns.Count == 0) { SetNoneWhere(t); } break; default: throw new Exception("请先选择操作种类"); } String where = ConvertToWhere(wherecolumns); if (!String.IsNullOrEmpty(where)) { sb.Append($" where {where}"); } batch.SqlBuilder = sb.ToString(); batch.DynamicParameters = Reduce.Parameters; return(batch); }
void handleOperation4(IList <MPI.Request> reqList_complete) { int[] arg1_values = new int[channel.RemoteSize]; int[] arg2_values = new int[channel.RemoteSize]; int[] arg3_values = new int[channel.RemoteSize]; int[] arg4_values = new int[channel.RemoteSize]; int[] arg5_values = new int[channel.RemoteSize]; int[] arg6_values = new int[channel.RemoteSize]; foreach (MPI.Request req in reqList_complete) { MPI.ReceiveRequest recv_req = (MPI.ReceiveRequest)req; MPI.CompletedStatus status = recv_req.Test(); Tuple <int, int, int, int, int, int> value = (Tuple <int, int, int, int, int, int>)recv_req.GetValue(); arg1_values [status.Source] = value.Item1; arg2_values [status.Source] = value.Item2; arg3_values [status.Source] = value.Item3; arg4_values [status.Source] = value.Item4; arg5_values [status.Source] = value.Item5; arg6_values [status.Source] = value.Item6; } IGather <int> arg1 = Gather <int> .create(channel, arg1_values); IReduce <int> arg2 = Reduce <int> .create(channel, arg2_values, sum, 0); IScan <int> arg3 = Scan <int> .create(channel, arg3_values, sum, 0); IGather <int> arg4 = Gather <int> .create(channel, arg4_values); IReduce <int> arg5 = Reduce <int> .create(channel, arg5_values, sum, 0); IScan <int> arg6 = Scan <int> .create(channel, arg6_values, sum, 0); int result = service.some_method_4(arg1, arg2, arg3, arg4, arg5, arg6); int[] broadcast_result = new int[channel.RemoteSize]; for (int i = 0; i < broadcast_result.Length; i++) { broadcast_result [i] = result; } returnResult(broadcast_result, OPERATION_4); }
private static void _Main(string[] args) { // input "x = 2*(3+3)" ICharStream input; if (args.Length > 0) { if (args[0].Equals("-i")) { if (args.Length > 1) { input = new ANTLRFileStream(args[1]); } else { throw new Exception("No input file specified."); } } else { input = new ANTLRStringStream(args[0]); } } else { input = new ANTLRInputStream(Console.OpenStandardInput()); } var lex = new VecMathLexer(input); var tokens = new CommonTokenStream(lex); var g = new VecMathParser(tokens); IAstRuleReturnScope<CommonTree> r = g.prog(); CommonTree t = r.Tree; Console.WriteLine("Original tree: " + t.ToStringTree()); var simplify = new Simplify(new CommonTreeNodeStream(t)); t = (CommonTree)simplify.Downup(t); var reduce = new Reduce(new CommonTreeNodeStream(t)); t = (CommonTree)reduce.Downup(t); Console.WriteLine("Simplified tree: " + t.ToStringTree()); Console.ReadKey(); }
/// <summary> /// Equals the specified other. /// </summary> /// <param name="other">The other.</param> /// <param name="compareIndexIds">allow caller to choose whether to include the index Id in the comparison</param> /// <returns></returns> public bool Equals(IndexDefinition other, bool compareIndexIds = true, bool ignoreFormatting = false, bool ignoreMaxIndexOutput = false) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (compareIndexIds && !Equals(other.IndexId, IndexId)) { return(false); } bool mapsReduceEquals; if (ignoreFormatting) { #if !DNXCORE50 var comparer = new IndexPrettyPrinterEqualityComparer(); mapsReduceEquals = Maps.SequenceEqual(other.Maps, comparer) && comparer.Equals(Reduce, other.Reduce); #else mapsReduceEquals = Maps.SequenceEqual(other.Maps) && Reduce.Equals(other.Reduce); #endif } else { mapsReduceEquals = Maps.SequenceEqual(other.Maps) && Equals(other.Reduce, Reduce); } return(mapsReduceEquals && (ignoreMaxIndexOutput || other.MaxIndexOutputsPerDocument == MaxIndexOutputsPerDocument) && DictionaryExtensions.ContentEquals(other.Stores, Stores) && DictionaryExtensions.ContentEquals(other.Indexes, Indexes) && DictionaryExtensions.ContentEquals(other.Analyzers, Analyzers) && DictionaryExtensions.ContentEquals(other.SortOptions, SortOptions) && DictionaryExtensions.ContentEquals(other.Suggestions, Suggestions) && DictionaryExtensions.ContentEquals(other.TermVectors, TermVectors) && DictionaryExtensions.ContentEquals(other.SpatialIndexes, SpatialIndexes)); }
public static Continuation Custom(this IMapSteps _, ContRegexDict mappings, Reduce<string> pathReducer, Continuation on404) { on404 = on404 ?? fu.Http.NotFound(); return step => ctx => { var path = pathReducer(ctx); var result = mappings .Select(kv => new { Match = kv.Key.Match(path), Cont = kv.Value }) .FirstOrDefault(m => m.Match.Success); if (result == null) on404(step)(ctx); else result.Cont(step)(new UrlMappedContext(ctx, result.Match)); }; }
private void BuildMap() { for(int index=0;index<states.Count;index++){ Set currentSet = (Set)states[index]; if (currentSet.IsFinalState){ actionMap[index][new End()] = new Accept(); } if (currentSet.ReduceStateId<=0) continue; foreach(ISymbol grammerSymbol in this.grammer.SymbolsInGrammer){ if (!grammerSymbol.IsNonTerminal()){ if (!actionMap[index].ContainsKey(grammerSymbol)) actionMap[index][grammerSymbol] = new Reduce(currentSet.ReduceStateId,grammer,this); } } } }
public static Continuation If(Reduce<bool> predicate, Continuation trueStep) { return fu.If(predicate, trueStep, fu.Identity); }
public static Continuation Expires(this ICacheSteps _, Reduce<DateTime> dateReducer) { return fu.Http.Header("Expires", ctx => dateReducer(ctx).ToString("R")); }
public static Continuation LastModified(this ICacheSteps _, Reduce<DateTime> lastModifiedReducer) { return _.LastModified((c, d) => lastModifiedReducer(c)); }
/// <summary> /// Remove empty rows from the given <see cref="Trie"/> and return the newly reduced <see cref="Trie"/>. /// </summary> /// <param name="by">the <see cref="Trie"/> to reduce</param> /// <returns>newly reduced <see cref="Trie"/></returns> public virtual Trie Reduce(Reduce by) { return by.Optimize(this); }
public static ResultContext From(IFuContext input, Reduce<object> jsonStep) { return new ResultContext(input, new JsonResult(jsonStep(input))); }
public static Continuation Text(this IStaticSteps _, Reduce<string> textReducer) { return step => ctx => step(StringResult.From(ctx, textReducer(ctx))); }
public static Continuation Json(this IStaticSteps _, Reduce<object> objReducer) { return step => ctx => step(JsonResult.From(ctx, objReducer(ctx))); }
/// <summary> /// Remove empty rows from the given <see cref="Trie"/> and return the newly reduced <see cref="Trie"/>. /// </summary> /// <param name="by">the <see cref="Trie"/> to reduce</param> /// <returns>the newly reduced Trie</returns> public override Trie Reduce(Reduce by) { List<Trie> h = new List<Trie>(); foreach (Trie trie in tries) h.Add(trie.Reduce(by)); MultiTrie m = new MultiTrie(forward); m.tries = h; return m; }
public void Get(string url, Reduce<Continuation> contReducer) { mapBranch(url, fu.Map.Get, contReducer); mapBranch(url, fu.Map.Head, contReducer); }
public void Put(string url, Reduce<Continuation> contReducer) { mapBranch(url, fu.Map.Put, contReducer); }
public static Continuation File(this IStaticSteps _, Reduce<string> filenameReducer, string contentType) { return _.File(filenameReducer, (c, filename) => contentType); }
public static Continuation Custom(this IMapSteps _, ContRegexDict mappings, Reduce<string> pathReducer) { return _.Custom(mappings, pathReducer, null); }
public static Continuation Branch(Reduce<Continuation> nextCont) { // nextCont supplies the continuation to execute here by reducing from the context return step => ctx => nextCont(ctx)(step)(ctx); }
public static Continuation To(this IRedirectSteps _, Reduce<string> urlReducer) { return _.To((c, s) => urlReducer(c)); }
public static Continuation Header(this IHttpSteps _, string header, Reduce<string> valueReducer) { return _.Header(header, (ctx, s) => valueReducer(ctx)); }
private void mapBranch(string url, Func<Continuation, Continuation, Continuation> wrapper, Reduce<Continuation> branchReducer) { Map(url, wrapper, fu.Branch(branchReducer)); }
public void Delete(string url, Reduce<Continuation> contReducer) { mapBranch(url, fu.Map.Delete, contReducer); }
public static Continuation File(this IStaticSteps _, Reduce<string> filenameReducer) { return _.File(filenameReducer, (c, filename) => Mime.FromFilename(filename)); }