Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-kad-dht
Commits
a3b97670
Commit
a3b97670
authored
Apr 12, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
providers: use the non-locking LRU
We only access it from a single goroutine.
parent
f4e6d425
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
providers/providers.go
providers/providers.go
+3
-3
No files found.
providers/providers.go
View file @
a3b97670
...
...
@@ -7,7 +7,7 @@ import (
"strings"
"time"
lru
"github.com/hashicorp/golang-lru"
lru
"github.com/hashicorp/golang-lru
/simplelru
"
cid
"github.com/ipfs/go-cid"
ds
"github.com/ipfs/go-datastore"
autobatch
"github.com/ipfs/go-datastore/autobatch"
...
...
@@ -30,7 +30,7 @@ var defaultCleanupInterval = time.Hour
type
ProviderManager
struct
{
// all non channel fields are meant to be accessed only within
// the run method
providers
*
lru
.
Cache
providers
*
lru
.
LRU
dstore
ds
.
Datastore
newprovs
chan
*
addProv
...
...
@@ -60,7 +60,7 @@ func NewProviderManager(ctx context.Context, local peer.ID, dstore ds.Batching)
pm
.
getprovs
=
make
(
chan
*
getProv
)
pm
.
newprovs
=
make
(
chan
*
addProv
)
pm
.
dstore
=
autobatch
.
NewAutoBatching
(
dstore
,
batchBufferSize
)
cache
,
err
:=
lru
.
New
(
lruCacheSize
)
cache
,
err
:=
lru
.
New
LRU
(
lruCacheSize
,
nil
)
if
err
!=
nil
{
panic
(
err
)
//only happens if negative value is passed to lru constructor
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment