Commit b233b2d9 authored by acud's avatar acud Committed by GitHub

chore: document implementation detail (#2313)

parent b4db606f
......@@ -261,7 +261,11 @@ func (db *DB) setRemove(batch *leveldb.Batch, item shed.Item, check bool) (gcSiz
func (db *DB) setPin(batch *leveldb.Batch, item shed.Item) (gcSizeChange int64, err error) {
// Get the existing pin counter of the chunk
i, err := db.pinIndex.Get(item)
// this will not panic because shed.Index.Get returns an instance, not a pointer.
// we therefore leverage the default value of the pin counter on the item (zero).
item.PinCounter = i.PinCounter
if err != nil {
if !errors.Is(err, leveldb.ErrNotFound) {
return 0, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment