Class RootScatterGather
java.lang.Object
org.opendaylight.controller.cluster.datastore.utils.RootScatterGather
Utility methods for dealing with datastore root
ContainerNode with respect to module shards.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ContainerNodecastRootNode(NormalizedNode node) Check whether aNormalizedNoderepresents a root container and return it cast toContainerNode.static @NonNull FluentFuture<Optional<NormalizedNode>> gather(ActorUtils actorUtils, Stream<FluentFuture<Optional<NormalizedNode>>> readFutures) Reconstruct root container from a set of constituents.static <T> @NonNull Stream<RootScatterGather.ShardContainer<T>> scatterAll(ContainerNode rootNode, Function<YangInstanceIdentifier.PathArgument, T> childToShard, Stream<T> allShards) static <T> @NonNull Stream<RootScatterGather.ShardContainer<T>> scatterTouched(ContainerNode rootNode, Function<YangInstanceIdentifier.PathArgument, T> childToShard) Split root container into per-shard root containers.
-
Method Details
-
castRootNode
Check whether aNormalizedNoderepresents a root container and return it cast toContainerNode.- Parameters:
node- a normalized node- Returns:
nodecast to ContainerNode- Throws:
NullPointerException- ifnodeis nullIllegalArgumentException- ifnodeis not aContainerNode
-
gather
public static @NonNull FluentFuture<Optional<NormalizedNode>> gather(ActorUtils actorUtils, Stream<FluentFuture<Optional<NormalizedNode>>> readFutures) Reconstruct root container from a set of constituents.- Parameters:
actorUtils-ActorUtilsreferencereadFutures- Consitutent read futures- Returns:
- A composite future
-
scatterAll
public static <T> @NonNull Stream<RootScatterGather.ShardContainer<T>> scatterAll(ContainerNode rootNode, Function<YangInstanceIdentifier.PathArgument, T> childToShard, Stream<T> allShards) -
scatterTouched
public static <T> @NonNull Stream<RootScatterGather.ShardContainer<T>> scatterTouched(ContainerNode rootNode, Function<YangInstanceIdentifier.PathArgument, T> childToShard) Split root container into per-shard root containers.- Type Parameters:
T- Shard reference type- Parameters:
rootNode- Root container to be split upchildToShard- Mapping function from childYangInstanceIdentifier.PathArgumentto shard reference- Returns:
- Stream of
RootScatterGather.ShardContainers, one for each touched shard
-