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 ContainerNode
castRootNode
(NormalizedNode node) Check whether aNormalizedNode
represents 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 aNormalizedNode
represents a root container and return it cast toContainerNode
.- Parameters:
node
- a normalized node- Returns:
node
cast to ContainerNode- Throws:
NullPointerException
- ifnode
is nullIllegalArgumentException
- ifnode
is 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
-ActorUtils
referencereadFutures
- 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.PathArgument
to shard reference- Returns:
- Stream of
RootScatterGather.ShardContainer
s, one for each touched shard
-