Skip to content

Commit

Permalink
refined
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
  • Loading branch information
wangxiaoxuan273 committed Dec 26, 2023
1 parent bac6f55 commit 2074587
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions internal/graph/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Memory struct {
// in the memory.
// - Memory.successors:
// 1. a node exists in Memory.successors if and only if it exists in the memory.
// 2. A node's entry in Memory.successors is always consistent with the actual
// 2. a node's entry in Memory.successors is always consistent with the actual
// content of the node, regardless of whether or not each successor exists
// in the memory.
nodes map[digest.Digest]ocispec.Descriptor
Expand Down Expand Up @@ -105,7 +105,6 @@ func (m *Memory) Predecessors(_ context.Context, node ocispec.Descriptor) ([]oci
m.lock.RLock()
defer m.lock.RUnlock()

// key := descriptor.FromOCI(node)
key := node.Digest
set, exists := m.predecessors[key]
if !exists {
Expand All @@ -124,7 +123,6 @@ func (m *Memory) Remove(node ocispec.Descriptor) []ocispec.Descriptor {
m.lock.Lock()
defer m.lock.Unlock()

// nodeKey := descriptor.FromOCI(node)
nodeKey := node.Digest
var danglings []ocispec.Descriptor
// remove the node from its successors' predecessor list
Expand Down Expand Up @@ -157,7 +155,6 @@ func (m *Memory) index(ctx context.Context, fetcher content.Fetcher, node ocispe
defer m.lock.Unlock()

// index the node
// nodeKey := descriptor.FromOCI(node)
nodeKey := node.Digest
m.nodes[nodeKey] = node

Expand All @@ -166,7 +163,6 @@ func (m *Memory) index(ctx context.Context, fetcher content.Fetcher, node ocispe
successorSet := set.New[digest.Digest]()
m.successors[nodeKey] = successorSet
for _, successor := range successors {
// successorKey := descriptor.FromOCI(successor)
successorKey := successor.Digest
successorSet.Add(successorKey)
predecessorSet, exists := m.predecessors[successorKey]
Expand Down

0 comments on commit 2074587

Please sign in to comment.