/
nilstate.go
45 lines (32 loc) · 1.16 KB
/
nilstate.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package session
import (
"time"
"github.com/filecoin-project/lassie/pkg/types"
"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime/datamodel"
"github.com/ipni/go-libipni/metadata"
"github.com/libp2p/go-libp2p/core/peer"
)
var _ State = nilstate{}
type nilstate struct{}
func (ns nilstate) RecordFailure(retrievalId types.RetrievalID, storageProviderId peer.ID) error {
return nil
}
func (ns nilstate) RecordSuccess(storageProviderId peer.ID, bandwidth uint64) {}
func (ns nilstate) GetConcurrency(storageProviderId peer.ID) uint {
return 0
}
func (ns nilstate) RegisterRetrieval(retrievalId types.RetrievalID, cid cid.Cid, selector datamodel.Node) bool {
return true
}
func (ns nilstate) AddToRetrieval(retrievalId types.RetrievalID, storageProviderIds []peer.ID) error {
return nil
}
func (ns nilstate) EndRetrieval(retrievalId types.RetrievalID) error {
return nil
}
func (ns nilstate) RecordConnectTime(storageProviderId peer.ID, connectTime time.Duration) {}
func (ns nilstate) RecordFirstByteTime(storageProviderId peer.ID, firstByteTime time.Duration) {}
func (ns nilstate) ChooseNextProvider(peers []peer.ID, mda []metadata.Protocol) int {
return 0
}