pekko/akka-stream/src/main/scala/akka/stream/Graph.scala

38 lines
1 KiB
Scala
Raw Normal View History

/**
2017-01-04 17:37:10 +01:00
* Copyright (C) 2015-2017 Lightbend Inc. <http://www.lightbend.com>
*/
package akka.stream
2016-07-27 13:29:23 +02:00
import akka.stream.impl.TraversalBuilder
import scala.annotation.unchecked.uncheckedVariance
trait Graph[+S <: Shape, +M] {
/**
* Type-level accessor for the shape parameter of this graph.
*/
type Shape = S @uncheckedVariance
/**
* The shape of a graph is all that is externally visible: its inlets and outlets.
*/
def shape: S
/**
* INTERNAL API.
*
* Every materializable element must be backed by a stream layout module
*/
2016-07-27 13:29:23 +02:00
private[stream] def traversalBuilder: TraversalBuilder
def withAttributes(attr: Attributes): Graph[S, M]
def named(name: String): Graph[S, M] = addAttributes(Attributes.name(name))
2015-12-14 17:02:00 +01:00
/**
* Put an asynchronous boundary around this `Graph`
*/
2016-07-27 13:29:23 +02:00
// TODO: no longer encoded as attributes!!!!
def async: Graph[S, M] = addAttributes(Attributes.asyncBoundary)
2016-07-27 13:29:23 +02:00
def addAttributes(attr: Attributes): Graph[S, M] = withAttributes(traversalBuilder.attributes and attr)
}