@@ -82,10 +82,9 @@ func (m *Memory) IndexAll(ctx context.Context, fetcher content.Fetcher, node oci
82
82
83
83
// Predecessors returns the nodes directly pointing to the current node.
84
84
// 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.
89
88
func (m * Memory ) Predecessors (_ context.Context , node ocispec.Descriptor ) ([]ocispec.Descriptor , error ) {
90
89
m .lock .RLock ()
91
90
defer m .lock .RUnlock ()
@@ -112,11 +111,9 @@ func (m *Memory) Remove(ctx context.Context, node ocispec.Descriptor) error {
112
111
for successorKey := range m .successors [nodeKey ] {
113
112
predecessorEntry := m .predecessors [successorKey ]
114
113
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.
120
117
if len (predecessorEntry ) == 0 {
121
118
delete (m .predecessors , successorKey )
122
119
}
0 commit comments