1 /*
2 * Copyright (C) 2015, Matthias Sohn <matthias.sohn@sap.com> and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10 package org.eclipse.jgit.lfs.server;
11
12 import java.io.IOException;
13
14 import org.eclipse.jgit.annotations.Nullable;
15 import org.eclipse.jgit.lfs.lib.AnyLongObjectId;
16
17 /**
18 * Abstraction of a repository for storing large objects
19 *
20 * @since 4.3
21 */
22 public interface LargeFileRepository {
23
24 /**
25 * Get download action
26 *
27 * @param id
28 * id of the object to download
29 * @return Action for downloading the object
30 */
31 Response.Action getDownloadAction(AnyLongObjectId id);
32
33 /**
34 * Get upload action
35 *
36 * @param id
37 * id of the object to upload
38 * @param size
39 * size of the object to be uploaded
40 * @return Action for uploading the object
41 */
42 Response.Action getUploadAction(AnyLongObjectId id, long size);
43
44 /**
45 * Get verify action
46 *
47 * @param id
48 * id of the object to be verified
49 * @return Action for verifying the object, or {@code null} if the server
50 * doesn't support or require verification
51 */
52 @Nullable
53 Response.Action getVerifyAction(AnyLongObjectId id);
54
55 /**
56 * Get size of an object
57 *
58 * @param id
59 * id of the object
60 * @return length of the object content in bytes, -1 if the object doesn't
61 * exist
62 * @throws java.io.IOException
63 */
64 long getSize(AnyLongObjectId id) throws IOException;
65 }