Interface CachedPlanManager

  • All Superinterfaces:
    FilteringPlanManager
    All Known Implementing Classes:
    CachedPlanManagerImpl

    public interface CachedPlanManager
    extends FilteringPlanManager
    Provides access to immutable, centrally cached plans. If the method does not contain `...WithConsistencyGuarantee` in its name, then it does not guarantee that the data is up-to-date a.k.a. highly consistent in the cluster mode.
    • Method Detail

      • getPlanByKey

        @Nullable
        @Nullable ImmutablePlan getPlanByKey​(@NotNull
                                             @NotNull PlanKey planKey)
        Returns a ImmutablePlan by its planKey. In clustered mode, there is NO consistency guarantee.
        Parameters:
        planKey - to search for
        Returns:
        plan with the given plan key or null if not found
      • getPlanByKeyWithConsistencyGuarantee

        @Nullable
        @Nullable ImmutablePlan getPlanByKeyWithConsistencyGuarantee​(@NotNull
                                                                     @NotNull PlanKey planKey)
        Returns a ImmutablePlan by its planKey. There is a guarantee that the data will be up-to-date.
        Parameters:
        planKey - to search for
        Returns:
        plan with the given plan key or null if not found
        Since:
        9.4
      • getPlanByKey

        @Nullable
        <T extends ImmutablePlan> T getPlanByKey​(@NotNull
                                                 @NotNull PlanKey planKey,
                                                 Class<T> planType)
                                          throws IncorrectPlanTypeException
        Returns a ImmutablePlan by its planKey and Class. In clustered mode, there is NO consistency guarantee.
        Parameters:
        planKey - to search for
        planType - - the type of the plan to retrieve
        Returns:
        plan with the given plan key, if found AND is of the correct type.
        Throws:
        IncorrectPlanTypeException - if plan cannot be found with the correct type
      • getPlanByKeyWithConsistencyGuarantee

        @Nullable
        <T extends ImmutablePlan> T getPlanByKeyWithConsistencyGuarantee​(@NotNull
                                                                         @NotNull PlanKey planKey,
                                                                         Class<T> planType)
                                                                  throws IncorrectPlanTypeException
        Returns a ImmutablePlan by its planKey and Class. There is a guarantee that the data will be up-to-date.
        Parameters:
        planKey - to search for
        planType - - the type of the plan to retrieve
        Returns:
        plan with the given plan key, if found AND is of the correct type.
        Throws:
        IncorrectPlanTypeException - if plan cannot be found with the correct type
      • getPlanByKeyIfOfType

        @Nullable
        <T extends ImmutablePlan> T getPlanByKeyIfOfType​(@NotNull
                                                         @NotNull PlanKey planKey,
                                                         @NotNull
                                                         @NotNull Class<T> planType)
        Returns a Plan by its planKey and if it's of the type Class. Does not throw IncorrectPlanTypeException. Should only be used when the type of the plan can not be known. In clustered mode, there is NO consistency guarantee.
        Type Parameters:
        T -
        Parameters:
        planKey -
        planType -
        Returns:
        null if the plan doesn't exist, or it's not of the found type
      • getPlanByKeyIfOfTypeWithConsistencyGuarantee

        @Nullable
        <T extends ImmutablePlan> T getPlanByKeyIfOfTypeWithConsistencyGuarantee​(@NotNull
                                                                                 @NotNull PlanKey planKey,
                                                                                 @NotNull
                                                                                 @NotNull Class<T> planType)
        Returns a Plan by its planKey and if it's of the type Class. Does not throw IncorrectPlanTypeException. Should only be used when the type of the plan can not be known. There is a guarantee that the data will be up-to-date.
        Type Parameters:
        T -
        Parameters:
        planKey -
        planType -
        Returns:
        null if the plan doesn't exist, or it's not of the found type
        Since:
        9.4
      • getPlanByIdNotThrowing

        @Nullable
        <T extends ImmutablePlan> T getPlanByIdNotThrowing​(long id,
                                                           Class<T> planType)
        Returns a ImmutablePlan by its database id and Class. This method does not throw exception if plan is not found. In clustered mode, there is NO consistency guarantee.
        Parameters:
        id - to search for
        planType - - the type of the plan to retrieve
        Returns:
        plan with the given database id, if found AND is of the correct type, null otherwise
        Since:
        6.8
      • getPlanByIdNotThrowingWithConsistencyGuarantee

        @Nullable
        <T extends ImmutablePlan> T getPlanByIdNotThrowingWithConsistencyGuarantee​(long id,
                                                                                   Class<T> planType)
        Returns a ImmutablePlan by its database id and Class. This method does not throw exception if plan is not found. There is a guarantee that the data will be up-to-date.
        Parameters:
        id - to search for
        planType - - the type of the plan to retrieve
        Returns:
        plan with the given database id, if found AND is of the correct type, null otherwise
        Since:
        9.4
      • getPlansUnrestrictedWithConsistencyGuarantee

        @NotNull
        @NotNull List<ImmutableTopLevelPlan> getPlansUnrestrictedWithConsistencyGuarantee()
        Returns all ImmutableTopLevelPlan's ignoring permissions. There is a guarantee that the data will be up-to-date.
        Since:
        9.4
      • getPlansByProjectUnrestricted

        @NotNull
        @NotNull List<ImmutableChain> getPlansByProjectUnrestricted​(Project project)
        Returns all ImmutableChain's filtered by Project ignoring permissions. In clustered mode, there is NO consistency guarantee.
        Parameters:
        project - - that the plans will belong to
        Returns:
        ImmutableChain plans contained within the given project
      • getPlansByProjectUnrestrictedWithConsistencyGuarantee

        @NotNull
        @NotNull List<ImmutableChain> getPlansByProjectUnrestrictedWithConsistencyGuarantee​(Project project)
        Returns all ImmutableChain's filtered by Project ignoring permissions. There is a guarantee that the data will be up-to-date.
        Parameters:
        project - - that the plans will belong to
        Returns:
        ImmutableChain plans contained within the given project
        Since:
        9.4
      • getBranchKeysOfChain

        @NotNull
        @NotNull Set<PlanKey> getBranchKeysOfChain​(@NotNull
                                                   @NotNull PlanKey chainKey)
        Returns keys of all branches for the supplied chain.
      • getBranchGistsOfChain

        @NotNull
        @NotNull Set<PlanBranchGist> getBranchGistsOfChain​(@NotNull
                                                           @NotNull PlanKey chainKey)
        Returns basic data of all branches for the supplied chain.
        Since:
        6.5
      • getBranchGistsOfChainWithConsistencyGuarantee

        @NotNull
        @NotNull Set<PlanBranchGist> getBranchGistsOfChainWithConsistencyGuarantee​(@NotNull
                                                                                   @NotNull PlanKey chainKey)
        Returns basic data of all branches for the supplied chain with guarantee that eventual new plan branches not present in the cache will be taken in consideration.
        Parameters:
        chainKey - the key of the chain
        Returns:
        highly-consistent list of branches' gists associated with a master plan identified by the given key, including eventual new branches not present in the database
        Since:
        9.5
      • getMasterPlan

        @Nullable
        @Nullable ImmutableChain getMasterPlan​(@NotNull
                                               @NotNull PlanKey branchKey)
        Returns master branch for a given branchKey. If branchKey identifies plan which has no master (is a master itself) then this plan is returned, otherwise a master of a plan is returned.
        Parameters:
        branchKey - key of a branch
        Returns:
        master branch for a given branchKey or null if branchKey doesn't identify a plan
      • isBranchOf

        boolean isBranchOf​(@NotNull
                           @NotNull PlanKey chainKey,
                           @NotNull
                           @NotNull PlanKey branchKey)
        Test if plan identified by branchKey is a branch of plan identified by chainKey. If branchKey identifies master plan method also returns true.
        Parameters:
        chainKey - key of master branch
        branchKey - key of alleged branch
        Returns:
        true if plan identified by branchKey is a branch of plan identified by chainKey, false otherwise
      • getMasterOfJob

        @Nullable
        @Nullable ImmutableJob getMasterOfJob​(@NotNull
                                              @NotNull PlanKey masterChainKey,
                                              @NotNull
                                              @NotNull PlanKey jobKey)
      • getPlansWithRepositoryWithConsistencyGuarantee

        Iterable<ImmutableChain> getPlansWithRepositoryWithConsistencyGuarantee​(@NotNull
                                                                                PlanRepositoryIndex.Query query)
        Returns chains that use repositories with given params. There is a guarantee that the data will be up-to-date.
        Since:
        9.4
      • getAllProjectsWithPlan

        Set<Project> getAllProjectsWithPlan()
        Returns all projects which have at least one plan (plan is in the cache)
        Returns: