github.com/ethersphere/bee/v2@v2.2.0/pkg/storer/internal/pinning/export_test.go (about) 1 // Copyright 2022 The Swarm Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package pinstore 6 7 import ( 8 "fmt" 9 10 storage "github.com/ethersphere/bee/v2/pkg/storage" 11 "github.com/ethersphere/bee/v2/pkg/swarm" 12 ) 13 14 type ( 15 PinCollectionItem = pinCollectionItem 16 PinChunkItem = pinChunkItem 17 DirtyCollection = dirtyCollection 18 ) 19 20 var ( 21 ErrInvalidPinCollectionItemAddr = errInvalidPinCollectionAddr 22 ErrInvalidPinCollectionItemUUID = errInvalidPinCollectionUUID 23 ErrInvalidPinCollectionItemSize = errInvalidPinCollectionSize 24 ErrPutterAlreadyClosed = errPutterAlreadyClosed 25 ErrCollectionRootAddressIsZero = errCollectionRootAddressIsZero 26 ) 27 28 var NewUUID = newUUID 29 30 func GetStat(st storage.Reader, root swarm.Address) (CollectionStat, error) { 31 collection := &pinCollectionItem{Addr: root} 32 err := st.Get(collection) 33 if err != nil { 34 return CollectionStat{}, fmt.Errorf("pin store: failed getting collection: %w", err) 35 } 36 37 return collection.Stat, nil 38 }