mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 18:22:01 +00:00
Implement gzip in FSGitRepoStore
This commit is contained in:
parent
1c81fcf501
commit
eba7cbe696
1 changed files with 28 additions and 0 deletions
|
@ -139,6 +139,15 @@ public class FSGitRepoStore implements RepoStore {
|
|||
return Tar.bz2.zip(getDotGitForProject(projectName), sizePtr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream gzipProject(
|
||||
String projectName,
|
||||
long[] sizePtr
|
||||
) throws IOException {
|
||||
Project.checkValidProjectName(projectName);
|
||||
return Tar.gzip.zip(getDotGitForProject(projectName), sizePtr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gcProject(String projectName) throws IOException {
|
||||
Project.checkValidProjectName(projectName);
|
||||
|
@ -171,6 +180,25 @@ public class FSGitRepoStore implements RepoStore {
|
|||
Tar.bz2.unzip(dataStream, getDirForProject(projectName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ungzipProject(
|
||||
String projectName,
|
||||
InputStream dataStream
|
||||
) throws IOException {
|
||||
Preconditions.checkArgument(
|
||||
Project.isValidProjectName(projectName),
|
||||
"[%s] invalid project name: ",
|
||||
projectName
|
||||
);
|
||||
Preconditions.checkState(
|
||||
getDirForProject(projectName).mkdirs(),
|
||||
"[%s] directories for " +
|
||||
"evicted project already exist",
|
||||
projectName
|
||||
);
|
||||
Tar.gzip.unzip(dataStream, getDirForProject(projectName));
|
||||
}
|
||||
|
||||
private File getDirForProject(String projectName) {
|
||||
Project.checkValidProjectName(projectName);
|
||||
return Paths.get(
|
||||
|
|
Loading…
Reference in a new issue