package com.atlassian.bitbucket.mesh.git.commit;

import javax.annotation.Nonnull;

@FunctionalInterface
public interface TraversalCallback {

    /**
     * Visit a node in the commit graph. All commits are guaranteed to be visited in topological order:
     * that is children will be visited before parents within the graph.
     *
     * @param node the current node being traversed
     * @return the status of the traversal after visiting the node. If traversal is
     *         {@link TraversalStatus#FINISH complete} this method will not be invoked again.
     */
    @Nonnull
    TraversalStatus onNode(@Nonnull CommitGraphNode node);
}
