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