blob: 8c4f0f25d1cf41060323f6e827d73ecd595b1f91 [file] [log] [blame]
// Copyright 2025 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.runtime;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.events.ExtendedEventHandler;
import com.google.devtools.build.lib.vfs.Path;
import java.io.IOException;
/** A remote cache for the contents of external repositories. */
public interface RemoteRepoContentsCache {
/** Adds a repository that has been fetched locally to the remote cache. */
void addToCache(
RepositoryName repoName,
Path fetchedRepoDir,
Path fetchedRepoMarkerFile,
String predeclaredInputHash,
ExtendedEventHandler reporter)
throws InterruptedException;
/**
* Retrieves a repository from the remote cache if possible.
*
* @return true if there was a cache hit and the repository has been fetched into the given
* directory.
*/
boolean lookupCache(
RepositoryName repoName,
Path repoDir,
String predeclaredInputHash,
ExtendedEventHandler reporter)
throws IOException, InterruptedException;
}