From 1c81fcf501f1835d7b9e982bd7fd387772f27ca6 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 14 Jan 2021 13:52:42 +0000 Subject: [PATCH] Add gzip to RepoStore interface --- .../ic/wlgitbridge/bridge/repo/RepoStore.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/RepoStore.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/RepoStore.java index 737d065f34..9aba00f477 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/RepoStore.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/RepoStore.java @@ -50,6 +50,22 @@ public interface RepoStore { return bzip2Project(projectName, null); } + /** + * Tars and gzips the .git directory of the given project. Throws an + * IOException if the project doesn't exist. The returned stream is a copy + * of the original .git directory, which must be deleted using remove(). + */ + InputStream gzipProject( + String projectName, + long[] sizePtr + ) throws IOException; + + default InputStream gzipProject( + String projectName + ) throws IOException { + return gzipProject(projectName, null); + } + void gcProject(String projectName) throws IOException; /** @@ -73,4 +89,16 @@ public interface RepoStore { InputStream dataStream ) throws IOException; + /** + * Ungzips the given data stream into a .git directory for projectName. + * Creates the project's git directory. + * If projectName already exists, throws an IOException. + * @param projectName the name of the project, e.g. abc123 + * @param dataStream the data stream containing the gzip contents. + */ + void ungzipProject( + String projectName, + InputStream dataStream + ) throws IOException; + }