Skip to content

Commit 012930a

Browse files
rephrased the doc
Signed-off-by: Xiaoxuan Wang <[email protected]>
1 parent f68a3a3 commit 012930a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

internal/graph/memory.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ func (m *Memory) IndexAll(ctx context.Context, fetcher content.Fetcher, node oci
8282

8383
// Predecessors returns the nodes directly pointing to the current node.
8484
// Predecessors returns nil without error if the node does not exists in the
85-
// store.
86-
// Like other operations, calling Predecessors() is go-routine safe. However,
87-
// it does not necessarily correspond to any consistent snapshot of the stored
88-
// contents.
85+
// store. Like other operations, calling Predecessors() is go-routine safe.
86+
// However, it does not necessarily correspond to any consistent snapshot of
87+
// the stored contents.
8988
func (m *Memory) Predecessors(_ context.Context, node ocispec.Descriptor) ([]ocispec.Descriptor, error) {
9089
m.lock.RLock()
9190
defer m.lock.RUnlock()
@@ -112,11 +111,9 @@ func (m *Memory) Remove(ctx context.Context, node ocispec.Descriptor) error {
112111
for successorKey := range m.successors[nodeKey] {
113112
predecessorEntry := m.predecessors[successorKey]
114113
predecessorEntry.Delete(nodeKey)
115-
// remove the successorKey entry from m. predecessors, if it's an empty set.
116-
// To it another way, if all its predecessors are already deleted, then we
117-
// delete the entry in m.predecessors. In any of its predecessors still exists,
118-
// the entry is NOT deleted. The presence of the predecessors entry depends on
119-
// the status of all predecessors of the node.
114+
115+
// if none of the predecessors of the node still exists, we remove the
116+
// predecessors entry. Otherwise, we do not remove the entry.
120117
if len(predecessorEntry) == 0 {
121118
delete(m.predecessors, successorKey)
122119
}

0 commit comments

Comments
 (0)