Home / Class/ Layer Class — spring-boot Architecture

Layer Class — spring-boot Architecture

Architecture documentation for the Layer class in TotalProgressListener.java from the spring-boot codebase.

Entity Profile

Source Code

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/TotalProgressListener.java lines 98–130

	private static class Layer {

		private final Map<String, Integer> progressByStatus = new HashMap<>();

		Layer(String[] trackedStatusKeys) {
			Arrays.stream(trackedStatusKeys).forEach((status) -> this.progressByStatus.put(status, 0));
		}

		void update(ImageProgressUpdateEvent event) {
			String status = event.getStatus();
			if (status == null) {
				return;
			}
			if (event.getProgressDetail() != null && this.progressByStatus.containsKey(status)) {
				int current = this.progressByStatus.get(status);
				this.progressByStatus.put(status, updateProgress(current, event.getProgressDetail()));
			}
		}

		private int updateProgress(int current, ProgressDetail detail) {
			return Math.max(detail.asPercentage(), current);
		}

		void finish() {
			this.progressByStatus.keySet().forEach((key) -> this.progressByStatus.put(key, 100));
		}

		int getProgress() {
			return withinPercentageBounds((this.progressByStatus.values().stream().mapToInt(Integer::intValue).sum())
					/ this.progressByStatus.size());
		}

	}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free