Class ShardGraphTracker
java.lang.Object
com.amazonaws.services.dynamodbv2.streamsadapter.util.ShardGraphTracker
Utility class for managing DynamoDB stream shard relationships and states.
Handles parent-child relationships and shard state transitions(i.e closing Open Parent
, Opening Leaf Nodes for Disabled Streams)
for stream processing.
Note: This class is NOT thread-safe by itself. Thread safety should be
handled by the calling context (e.g., DynamoDBStreamsShardDetector's
synchronized methods).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Processes parent-child relationships by closing open parent shards that have children.void
collectShards
(List<software.amazon.awssdk.services.kinesis.model.Shard> shards) Collects and stores shards for processing.List<software.amazon.awssdk.services.kinesis.model.Shard>
Retrieves the list of all processed shards with their final states.void
Marks leaf shards as active by removing their ending sequence numbers.
-
Constructor Details
-
ShardGraphTracker
public ShardGraphTracker()
-
-
Method Details
-
collectShards
Collects and stores shards for processing. This is the first phase of shard processing where all shards are gathered before any state modifications.- Parameters:
shards
- List of shards to be processed. Can be null or empty.
-
closeOpenParents
public void closeOpenParents()Processes parent-child relationships by closing open parent shards that have children. A parent shard is considered open if it has no ending sequence number. When closed, the parent shard's ending sequence number is set to maximum value. This is the second phase of shard processing. -
markLeafShardsActive
public void markLeafShardsActive()Marks leaf shards as active by removing their ending sequence numbers. A shard is considered a leaf if it is not a parent to any other shard. This is typically used for disabled streams where leaf shards need to remain active. This is the third phase of shard processing. -
getShards
Retrieves the list of all processed shards with their final states. This should be called after all necessary processing phases are complete.- Returns:
- A new list containing all processed shards
-