GetCommitDataByIndex gets the commit node from the commit graph using index obtained from child node, if available
(i uint32)
| 49 | // GetCommitDataByIndex gets the commit node from the commit graph using index |
| 50 | // obtained from child node, if available |
| 51 | func (mi *MemoryIndex) GetCommitDataByIndex(i uint32) (*CommitData, error) { |
| 52 | if i >= uint32(len(mi.commitData)) { |
| 53 | return nil, plumbing.ErrObjectNotFound |
| 54 | } |
| 55 | |
| 56 | commitData := mi.commitData[i] |
| 57 | |
| 58 | // Map parent hashes to parent indexes |
| 59 | if commitData.ParentIndexes == nil { |
| 60 | parentIndexes := make([]uint32, len(commitData.ParentHashes)) |
| 61 | for i, parentHash := range commitData.ParentHashes { |
| 62 | var err error |
| 63 | if parentIndexes[i], err = mi.GetIndexByHash(parentHash); err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | } |
| 67 | commitData.ParentIndexes = parentIndexes |
| 68 | } |
| 69 | |
| 70 | return commitData.CommitData, nil |
| 71 | } |
| 72 | |
| 73 | // Hashes returns all the hashes that are available in the index |
| 74 | func (mi *MemoryIndex) Hashes() []plumbing.Hash { |
nothing calls this directly
no test coverage detected