Improve badges in README

This commit is contained in:
Hector Sanjuan 2022-06-15 15:06:58 +02:00
parent bc8b65a099
commit b705212ac0
4 changed files with 20 additions and 7 deletions

View File

@ -1,10 +1,10 @@
# IPFS Cluster
[![Made by](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai)
[![Main project](https://img.shields.io/badge/project-ipfs--cluster-blue.svg?style=flat-square)](http://github.com/ipfs-cluster)
[![Matrix channel](https://img.shields.io/badge/matrix-%23ipfs--cluster-blue.svg?style=flat-square)](https://app.element.io/#/room/#ipfs-cluster:ipfs.io)
[![Matrix channel](https://img.shields.io/badge/matrix-%23ipfs--cluster-blue.svg?style=flat-square)](https://app.element.io/#/room/#ipfs-cluster:ipfs.io)
[![Made by](https://img.shields.io/badge/made%20by-Protocol%20Labs-000000.svg?style=flat-square)](https://protocol.ai)
[![Main project](https://img.shields.io/badge/project-ipfs--cluster-5ab5bf.svg?style=flat-square)](http://github.com/ipfs-cluster)
[![Discord](https://img.shields.io/badge/forum-discuss.ipfs.io-f9c478.svg?style=flat-square)](https://app.element.io/#/room/#ipfs-cluster:ipfs.io)
[![Matrix channel](https://img.shields.io/badge/matrix-%23ipfs--cluster-9ddde3.svg?style=flat-square)](https://app.element.io/#/room/#ipfs-cluster:ipfs.io)
[![pkg.go.dev](https://pkg.go.dev/badge/github.com/ipfs-cluster/ipfs-cluster)](https://pkg.go.dev/github.com/ipfs-cluster/ipfs-cluster)
[![Go Report Card](https://goreportcard.com/badge/github.com/ipfs-cluster/ipfs-cluster)](https://goreportcard.com/report/github.com/ipfs-cluster/ipfs-cluster)
[![codecov](https://codecov.io/gh/ipfs-cluster/ipfs-cluster/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs-cluster/ipfs-cluster)

View File

@ -102,6 +102,11 @@ func (c *Cluster) allocate(ctx context.Context, hash api.Cid, currentPin api.Pin
if err != nil {
return newAllocs, err
}
// if current allocations are above the minimal threshold,
// obtainAllocations returns nil and we just leave things as they are.
// This is what makes repinning do nothing if items are still above
// rmin.
if newAllocs == nil {
newAllocs = currentAllocs
}

View File

@ -1,8 +1,9 @@
# ipfs-cluster client
[![Made by](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai)
[![Main project](https://img.shields.io/badge/project-ipfs-blue.svg?style=flat-square)](http://github.com/ipfs-cluster/ipfs-cluster)
[![Matrix channel](https://img.shields.io/badge/matrix-%23ipfs--cluster-blue.svg?style=flat-square)](https://app.element.io/#/room/#ipfs-cluster:ipfs.io)
[![Made by](https://img.shields.io/badge/made%20by-Protocol%20Labs-000000.svg?style=flat-square)](https://protocol.ai)
[![Main project](https://img.shields.io/badge/project-ipfs--cluster-5ab5bf.svg?style=flat-square)](http://github.com/ipfs-cluster)
[![Discord](https://img.shields.io/badge/forum-discuss.ipfs.io-f9c478.svg?style=flat-square)](https://app.element.io/#/room/#ipfs-cluster:ipfs.io)
[![Matrix channel](https://img.shields.io/badge/matrix-%23ipfs--cluster-9ddde3.svg?style=flat-square)](https://app.element.io/#/room/#ipfs-cluster:ipfs.io)
[![pkg.go.dev](https://pkg.go.dev/badge/github.com/ipfs-cluster/ipfs-cluster)](https://pkg.go.dev/github.com/ipfs-cluster/ipfs-cluster/api/rest/client)

View File

@ -639,6 +639,8 @@ func (c *Cluster) repinFromPeer(ctx context.Context, p peer.ID, pin api.Pin) {
defer span.End()
pin.Allocations = nil // force re-allocations
// note that pin() should not result in different allocations
// if we are not under the replication-factor min.
_, ok, err := c.pin(ctx, pin, []peer.ID{p})
if ok && err == nil {
logger.Infof("repinned %s out of %s", pin.Cid, p.Pretty())
@ -1553,6 +1555,11 @@ func (c *Cluster) pin(
// pins to the consensus layer even if they are, this should trigger the
// pin tracker and allows users to get re-pin operations by re-adding
// without having to use recover, which is naturally expected.
//
// blacklist is set on repinFromPeer having any blacklisted peers
// means we are repinning and need to trigger allocate(), therefore we
// can't overwrite the incoming pin (which has Allocations set to
// nil).
if existing.Defined() &&
pin.PinOptions.Equals(existing.PinOptions) &&
len(blacklist) == 0 {