Documentation ¶
Index ¶
- type Pin
- type PinnedCid
- type Store
- func (s *Store) Add(iid ffs.APIID, c cid.Cid) error
- func (s *Store) AddStaged(iid ffs.APIID, c cid.Cid) error
- func (s *Store) GetAll() ([]PinnedCid, error)
- func (s *Store) GetAllOnlyStaged() ([]PinnedCid, error)
- func (s *Store) IsPinned(c cid.Cid) bool
- func (s *Store) IsPinnedBy(iid ffs.APIID, c cid.Cid) bool
- func (s *Store) RefCount(c cid.Cid) (int, int)
- func (s *Store) Remove(iid ffs.APIID, c cid.Cid) error
- func (s *Store) RemoveStaged(c cid.Cid) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pin ¶
Pin describes a pin of a Cid from a APIID. The Stage field indicates if the pin is a stage-pin.
type PinnedCid ¶
type PinnedCid struct { Cid cid.Cid Pins []Pin }
PinnedCid contains information about a pinned Cid from multiple APIIDs.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store saves information about pinned Cids per APIID. It can be understood as the pinset for a set of APIIDs. There're two types of pins: stage-pins and full-pins. Stage-pins indicate a form of soft-pinning that clients might use as an indication of unpinnable Cids by GC processes.
func (*Store) Add ¶
Add marks c as fully-pinned by iid. If c is already stage-pinned, then is switched to fully-pinned. If c is already fully-pinned, then only its timestamp gets refreshed.
func (*Store) AddStaged ¶
AddStaged pins a Cid for APIID with a staged-pin. If c is already stage-pinned, its stage-pin timestamp will be refreshed. If c is already fully-pinned, this call is a noop (full-pin will be kept).
func (*Store) GetAllOnlyStaged ¶
GetAllOnlyStaged returns all cids that only have stage-pins.
func (*Store) IsPinnedBy ¶
IsPinnedBy returns true if the Cid is pinned for APIID. Both strong and staged pins are considered.
func (*Store) RefCount ¶
RefCount returns two integers (total, staged). total is the total number of ref counts for the Cid. staged is the total number of ref counts corresponding to staged pins. total includes staged, this means that: * total >= staged * non-staged pins = total - staged.
func (*Store) Remove ¶
Remove unpins c for iid regarding any pin type. If c is unpinned for iid, this is a noop.
func (*Store) RemoveStaged ¶
RemoveStaged deletes from the pinstore c if all existing pins are stage-pins, if not it fails. This is a safe method used by GCs to unpin unpinnable cids.