1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.internal.storage.file;
12
13 import java.io.File;
14 import java.io.IOException;
15 import java.util.Collection;
16 import java.util.Set;
17
18 import org.eclipse.jgit.internal.storage.pack.ObjectToPack;
19 import org.eclipse.jgit.internal.storage.pack.PackWriter;
20 import org.eclipse.jgit.lib.AbbreviatedObjectId;
21 import org.eclipse.jgit.lib.AnyObjectId;
22 import org.eclipse.jgit.lib.Config;
23 import org.eclipse.jgit.lib.ObjectDatabase;
24 import org.eclipse.jgit.lib.ObjectId;
25 import org.eclipse.jgit.lib.ObjectLoader;
26 import org.eclipse.jgit.lib.ObjectReader;
27 import org.eclipse.jgit.util.FS;
28
29 abstract class FileObjectDatabase extends ObjectDatabase {
30 enum InsertLooseObjectResult {
31 INSERTED, EXISTS_PACKED, EXISTS_LOOSE, FAILURE;
32 }
33
34
35 @Override
36 public ObjectReader newReader() {
37 return new WindowCursor(this);
38 }
39
40
41 @Override
42 public ObjectDirectoryInserter newInserter() {
43 return new ObjectDirectoryInserter(this, getConfig());
44 }
45
46 abstract void resolve(Set<ObjectId> matches, AbbreviatedObjectId id)
47 throws IOException;
48
49 abstract Config getConfig();
50
51 abstract FS getFS();
52
53 abstract Set<ObjectId> getShallowCommits() throws IOException;
54
55 abstract void selectObjectRepresentation(PackWriter packer,
56 ObjectToPack otp, WindowCursor curs) throws IOException;
57
58 abstract File getDirectory();
59
60 abstract File fileFor(AnyObjectId id);
61
62 abstract ObjectLoader openObject(WindowCursor curs, AnyObjectId objectId)
63 throws IOException;
64
65 abstract long getObjectSize(WindowCursor curs, AnyObjectId objectId)
66 throws IOException;
67
68 abstract ObjectLoader openLooseObject(WindowCursor curs, AnyObjectId id)
69 throws IOException;
70
71 abstract InsertLooseObjectResult insertUnpackedObject(File tmp,
72 ObjectId id, boolean createDuplicate) throws IOException;
73
74 abstract Pack openPack(File pack) throws IOException;
75
76 abstract Collection<Pack> getPacks();
77 }