Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public static Settings getProjectSettings(ProjectId projectId, ClusterState clus
return registry.projectsSettings.getOrDefault(projectId, Settings.EMPTY);
}

public boolean isProjectMarkedForDeletion(ProjectId projectId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this to ProjectState as well?

return projectsMarkedForDeletion.contains(projectId);
}

@Override
public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params) {
boolean multiProject = params.paramAsBoolean("multi-project", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.cluster.metadata.ProjectMetadata;
import org.elasticsearch.cluster.project.ProjectStateRegistry;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.reservedstate.ReservedProjectStateHandler;
import org.elasticsearch.reservedstate.TransformState;
Expand Down Expand Up @@ -73,14 +72,14 @@ protected ClusterState execute(ClusterState currentState) {
}

ClusterState updatedClusterState = result.v1();
Settings updatedSettings = ProjectStateRegistry.getProjectSettings(projectId, updatedClusterState);
ProjectMetadata updatedProject = updatedClusterState.getMetadata().getProject(projectId);
ProjectStateRegistry updatedProjectStateRegistry = updatedClusterState.custom(
ProjectStateRegistry.TYPE,
ProjectStateRegistry.EMPTY
);
ProjectMetadata updatedProjectMetadata = updatedClusterState.getMetadata().getProject(projectId);
return ClusterState.builder(currentState)
.putCustom(
ProjectStateRegistry.TYPE,
ProjectStateRegistry.builder(currentState).putProjectSettings(projectId, updatedSettings).build()
)
.putProjectMetadata(ProjectMetadata.builder(updatedProject).put(result.v2()))
.putCustom(ProjectStateRegistry.TYPE, ProjectStateRegistry.builder(updatedProjectStateRegistry).build())
.putProjectMetadata(ProjectMetadata.builder(updatedProjectMetadata).put(result.v2()))
.build();
}
}