|
1 |
| -package commitgraph |
2 |
| - |
3 |
| -import ( |
4 |
| - "time" |
5 |
| - |
6 |
| - "gopkg.in/src-d/go-git.v4/plumbing" |
7 |
| -) |
8 |
| - |
9 |
| -// CommitData is a reduced representation of Commit as presented in the commit graph |
10 |
| -// file. It is merely useful as an optimization for walking the commit graphs. |
11 |
| -type CommitData struct { |
12 |
| - // TreeHash is the hash of the root tree of the commit. |
13 |
| - TreeHash plumbing.Hash |
14 |
| - // ParentIndexes are the indexes of the parent commits of the commit. |
15 |
| - ParentIndexes []int |
16 |
| - // ParentHashes are the hashes of the parent commits of the commit. |
17 |
| - ParentHashes []plumbing.Hash |
18 |
| - // Generation number is the pre-computed generation in the commit graph |
19 |
| - // or zero if not available |
20 |
| - Generation int |
21 |
| - // When is the timestamp of the commit. |
22 |
| - When time.Time |
23 |
| -} |
24 |
| - |
25 |
| -// Index represents a representation of commit graph that allows indexed |
26 |
| -// access to the nodes using commit object hash |
27 |
| -type Index interface { |
28 |
| - // GetIndexByHash gets the index in the commit graph from commit hash, if available |
29 |
| - GetIndexByHash(h plumbing.Hash) (int, error) |
30 |
| - // GetNodeByIndex gets the commit node from the commit graph using index |
31 |
| - // obtained from child node, if available |
32 |
| - GetCommitDataByIndex(i int) (*CommitData, error) |
33 |
| - // Hashes returns all the hashes that are available in the index |
34 |
| - Hashes() []plumbing.Hash |
35 |
| -} |
| 1 | +package commitgraph |
| 2 | + |
| 3 | +import ( |
| 4 | + "time" |
| 5 | + |
| 6 | + "gopkg.in/src-d/go-git.v4/plumbing" |
| 7 | +) |
| 8 | + |
| 9 | +// CommitData is a reduced representation of Commit as presented in the commit graph |
| 10 | +// file. It is merely useful as an optimization for walking the commit graphs. |
| 11 | +type CommitData struct { |
| 12 | + // TreeHash is the hash of the root tree of the commit. |
| 13 | + TreeHash plumbing.Hash |
| 14 | + // ParentIndexes are the indexes of the parent commits of the commit. |
| 15 | + ParentIndexes []int |
| 16 | + // ParentHashes are the hashes of the parent commits of the commit. |
| 17 | + ParentHashes []plumbing.Hash |
| 18 | + // Generation number is the pre-computed generation in the commit graph |
| 19 | + // or zero if not available |
| 20 | + Generation int |
| 21 | + // When is the timestamp of the commit. |
| 22 | + When time.Time |
| 23 | +} |
| 24 | + |
| 25 | +// Index represents a representation of commit graph that allows indexed |
| 26 | +// access to the nodes using commit object hash |
| 27 | +type Index interface { |
| 28 | + // GetIndexByHash gets the index in the commit graph from commit hash, if available |
| 29 | + GetIndexByHash(h plumbing.Hash) (int, error) |
| 30 | + // GetNodeByIndex gets the commit node from the commit graph using index |
| 31 | + // obtained from child node, if available |
| 32 | + GetCommitDataByIndex(i int) (*CommitData, error) |
| 33 | + // Hashes returns all the hashes that are available in the index |
| 34 | + Hashes() []plumbing.Hash |
| 35 | +} |
0 commit comments