@@ -26,18 +26,23 @@ import (
26
26
const (
27
27
// ProvidersKeyPrefix is the prefix/namespace for ALL provider record
28
28
// keys stored in the data store.
29
+ //
30
+ // Deprecated: use records.ProvidersKeyPrefix
29
31
ProvidersKeyPrefix = "/providers/"
30
32
31
33
// ProviderAddrTTL is the TTL to keep the multi addresses of provider
32
34
// peers around. Those addresses are returned alongside provider. After
33
35
// it expires, the returned records will require an extra lookup, to
34
36
// find the multiaddress associated with the returned peer id.
37
+ //
38
+ // Deprecated: use records.ProviderAddrTTL
35
39
ProviderAddrTTL = amino .DefaultProviderAddrTTL
36
40
)
37
41
38
42
// ProvideValidity is the default time that a Provider Record should last on DHT
39
43
// This value is also known as Provider Record Expiration Interval.
40
44
var (
45
+ // Deprecated: use records.ProvideValidity
41
46
ProvideValidity = amino .DefaultProvideValidity
42
47
defaultCleanupInterval = time .Hour
43
48
lruCacheSize = 256
46
51
)
47
52
48
53
// ProviderStore represents a store that associates peers and their addresses to keys.
54
+ //
55
+ // Deprecated: use records.ProviderStore
49
56
type ProviderStore interface {
50
57
AddProvider (ctx context.Context , key []byte , prov peer.AddrInfo ) error
51
58
GetProviders (ctx context.Context , key []byte ) ([]peer.AddrInfo , error )
@@ -54,6 +61,8 @@ type ProviderStore interface {
54
61
55
62
// ProviderManager adds and pulls providers out of the datastore,
56
63
// caching them in between
64
+ //
65
+ // Deprecated: use records.ProviderManager
57
66
type ProviderManager struct {
58
67
self peer.ID
59
68
// all non channel fields are meant to be accessed only within
@@ -75,6 +84,8 @@ type ProviderManager struct {
75
84
var _ ProviderStore = (* ProviderManager )(nil )
76
85
77
86
// Option is a function that sets a provider manager option.
87
+ //
88
+ // Deprecated: use records.Option
78
89
type Option func (* ProviderManager ) error
79
90
80
91
func (pm * ProviderManager ) applyOptions (opts ... Option ) error {
@@ -88,6 +99,8 @@ func (pm *ProviderManager) applyOptions(opts ...Option) error {
88
99
89
100
// CleanupInterval sets the time between GC runs.
90
101
// Defaults to 1h.
102
+ //
103
+ // Deprecated: use records package instead
91
104
func CleanupInterval (d time.Duration ) Option {
92
105
return func (pm * ProviderManager ) error {
93
106
pm .cleanupInterval = d
@@ -97,6 +110,8 @@ func CleanupInterval(d time.Duration) Option {
97
110
98
111
// Cache sets the LRU cache implementation.
99
112
// Defaults to a simple LRU cache.
113
+ //
114
+ // Deprecated: use records package instead
100
115
func Cache (c lru.LRUCache ) Option {
101
116
return func (pm * ProviderManager ) error {
102
117
pm .cache = c
@@ -117,6 +132,8 @@ type getProv struct {
117
132
}
118
133
119
134
// NewProviderManager constructor
135
+ //
136
+ // Deprecated: use records.NewProviderManager
120
137
func NewProviderManager (ctx context.Context , local peer.ID , ps peerstore.Peerstore , dstore ds.Batching , opts ... Option ) (* ProviderManager , error ) {
121
138
pm := new (ProviderManager )
122
139
pm .self = local
0 commit comments