Skip to content

Commit

Permalink
Merge pull request #82 from vasily-kirichenko/add-runnable-graph-wrap…
Browse files Browse the repository at this point in the history
…pers-2

Add more wrappers over IRunnableGraph
  • Loading branch information
Horusiath committed Dec 23, 2017
2 parents ecad10e + 9703327 commit 03d5238
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Akkling.Streams/Graph.fs
Expand Up @@ -41,6 +41,28 @@ module Graph =
let run (mat: #IMaterializer) (graph: #IRunnableGraph<'mat>) =
graph.Run mat

/// Transform only the materialized value of this RunnableGraph, leaving all other properties as they were.
let inline mapMaterializedValue (fn: 'mat -> 'mat2) (graph: #IRunnableGraph<'mat>) : IRunnableGraph<'mat2> =
graph.MapMaterializedValue(Func<_,_>(fn))

/// Change the attributes of this <see cref="T:Akka.Streams.IGraph`1" /> to the given ones and seal the list
/// of attributes. This means that further calls will not be able to remove these attributes, but instead add new ones.
/// Note that this operation has no effect on an empty Flow (because the attributes apply only to the contained
/// processing stages).
let inline withAttributes (attributes: Attributes) (graph: #IRunnableGraph<'mat>) : IRunnableGraph<'mat> =
graph.WithAttributes(attributes)

/// Add the given attributes to this <see cref="T:Akka.Streams.IGraph`1" />.
/// Further calls to <see cref="M:Akka.Streams.Dsl.IRunnableGraph`1.WithAttributes(Akka.Streams.Attributes)" />
/// will not remove these attributes. Note that this operation has no effect on an empty Flow (because the attributes apply
/// only to the contained processing stages).
let inline addAttributes(attributes: Attributes) (graph: #IRunnableGraph<'mat>) : IRunnableGraph<'mat> =
graph.AddAttributes(attributes)

/// Add a name attribute to this Graph.
let inline named (graph: #IRunnableGraph<'mat>) (name: string) : IRunnableGraph<'mat> =
graph.Named(name)

module Operators =

open Akka.Streams
Expand Down

0 comments on commit 03d5238

Please sign in to comment.