Unverified Commit 4733550d authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #20 from ipfs/fix/use-2q

cache: switch to 2q
parents 8d6a694a b40a71c7
......@@ -10,7 +10,6 @@ env:
global:
- GOTFLAGS="-race"
matrix:
- BUILD_DEPTYPE=gx
- BUILD_DEPTYPE=gomod
......@@ -24,7 +23,6 @@ script:
cache:
directories:
- $GOPATH/src/gx
- $GOPATH/pkg/mod
- $HOME/.cache/go-build
......
all: deps
gx:
go get github.com/whyrusleeping/gx
go get github.com/whyrusleeping/gx-go
deps: gx
gx --verbose install --global
gx-go rewrite
test: deps
gx test -v -race -coverprofile=coverage.txt -covermode=atomic .
rw:
gx-go rewrite
rwundo:
gx-go rewrite --undo
publish: rwundo
gx publish
.PHONY: all gx deps test rw rwundo publish
......@@ -16,7 +16,7 @@ type cacheSize int
// block Cids. This provides block access-time improvements, allowing
// to short-cut many searches without query-ing the underlying datastore.
type arccache struct {
arc *lru.ARCCache
arc *lru.TwoQueueCache
blockstore Blockstore
hits metrics.Counter
......@@ -24,7 +24,7 @@ type arccache struct {
}
func newARCCachedBS(ctx context.Context, bs Blockstore, lruSize int) (*arccache, error) {
arc, err := lru.NewARC(lruSize)
arc, err := lru.New2Q(lruSize)
if err != nil {
return nil, err
}
......
......@@ -148,7 +148,7 @@ func (b *bloomcache) Has(k cid.Cid) (bool, error) {
}
func (b *bloomcache) GetSize(k cid.Cid) (int, error) {
return b.blockstore.GetSize(k)
return b.blockstore.GetSize(k)
}
func (b *bloomcache) Get(k cid.Cid) (blocks.Block, error) {
......
{
"author": "hsanjuan",
"bugs": {
"url": "https://github.com/ipfs/go-ipfs-blockstore"
},
"gx": {
"dvcsimport": "github.com/ipfs/go-ipfs-blockstore"
},
"gxDependencies": [
{
"author": "stebalien",
"hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK",
"name": "go-block-format",
"version": "0.2.2"
},
{
"author": "jbenet",
"hash": "QmUadX5EcvrBmxAV9sE7wUWtWSqxns5K84qKJBixmcT1w9",
"name": "go-datastore",
"version": "3.6.1"
},
{
"author": "ipfs",
"hash": "QmekzFM3hPZjTjUFGTABdQkEnQ3PTiMstY198PwSFr5w1Q",
"name": "go-metrics-interface",
"version": "0.2.0"
},
{
"author": "hashicorp",
"hash": "QmQjMHF8ptRgx4E57UFMiT4YM6kqaJeYxZ1MCDX23aw4rK",
"name": "golang-lru",
"version": "2017.10.18"
},
{
"author": "whyrusleeping",
"hash": "QmTbxNB1NwDesLmKTscr4udL2tVP7MaxvXnD1D9yX7g3PN",
"name": "go-cid",
"version": "0.9.3"
},
{
"author": "hector",
"hash": "QmXSEqXLCzpCByJU4wqbJ37TcBEj77FKMUWUP1qLh56847",
"name": "go-ipfs-ds-help",
"version": "0.1.7"
},
{
"author": "kubuxu",
"hash": "QmWaLViWQF8jgyoLLqqcSrnp6dJpHESiJfzor1vrfDyTZf",
"name": "bbloom",
"version": "0.1.2"
},
{
"hash": "QmbkT7eMTyXfpeyB3ZMxxcxg7XH8t6uXp49jqzz4HB7BGF",
"name": "go-log",
"version": "1.5.9"
}
],
"gxVersion": "0.12.1",
"language": "go",
"license": "MIT",
"name": "go-ipfs-blockstore",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "0.1.8"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment