Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating to new datastore/blockstore code with contexts #7646

Merged
merged 58 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
072297e
WIP: updating to new datastore/blockstore code with contexts
whyrusleeping Nov 19, 2021
b9b4a26
Update go-data-transfer
arajasek Dec 7, 2021
a9e22df
update deps
vyzo Dec 9, 2021
276eabd
Update go-storedcounter and go-ds-versioning
arajasek Dec 10, 2021
702a781
Update go-car
arajasek Dec 10, 2021
095361b
Update carv2
arajasek Dec 11, 2021
6c31cec
Update markets
arajasek Dec 11, 2021
dfb65ed
Plumb contexts through
arajasek Dec 11, 2021
e5895af
Update go-ipld-cbor
arajasek Dec 11, 2021
97a91f2
update go-ds-measure and go-filestore
vyzo Dec 13, 2021
7ed40c1
go get drand@release/v1.3
vyzo Dec 13, 2021
84710cf
plumb more contexts in lotus
vyzo Dec 13, 2021
2e057b8
plumb contexts in lotus-miner
vyzo Dec 13, 2021
a8fcaeb
plumb contexts in lotus-shed
vyzo Dec 13, 2021
5eb5fcd
fix lotus-bench
vyzo Dec 13, 2021
73c7e9e
go mod tidy
vyzo Dec 13, 2021
b314802
plumb contexts in conformance
vyzo Dec 13, 2021
47bac4a
plumb context in tvx
vyzo Dec 13, 2021
e4233e4
plumb contexts in lotus-sim
vyzo Dec 13, 2021
0001a6b
update go-libp2p to v0.17
vyzo Dec 14, 2021
773f896
update go-libp2p-connmgr to v0.3
vyzo Dec 14, 2021
f157ac9
update for new ConnManager constructor
vyzo Dec 14, 2021
73ca65a
update drand
vyzo Dec 14, 2021
fc7d4a1
fix itests
vyzo Dec 14, 2021
eb48dc9
fix issues with new peerstore constructor signature in DI
vyzo Dec 14, 2021
716b4a3
hook a great context in the sky to satisfy DI; sigh...
vyzo Dec 14, 2021
22ce395
fix some unit tests
vyzo Dec 14, 2021
40c61a3
fix splitstore test
vyzo Dec 14, 2021
5e692f9
fix more tests
vyzo Dec 14, 2021
780dfa0
fix ReorgOps incantation in events test
vyzo Dec 14, 2021
e6a8c27
fix messagepool test mock provider
vyzo Dec 14, 2021
6ecbceb
fix messagepool repub test
vyzo Dec 14, 2021
a0353c8
fix messagepool selection test
vyzo Dec 14, 2021
63487e1
fix checkpoint test
vyzo Dec 14, 2021
e8df325
update lotus-soup deps
vyzo Dec 14, 2021
0eec000
fix lotus-soup build
vyzo Dec 14, 2021
a3ea3ad
Deps: Update actors v2
arajasek Dec 14, 2021
e163412
fix paychmgr test
vyzo Dec 14, 2021
f00698a
fix more paychmgr tests
vyzo Dec 14, 2021
aac6d88
Deps: Update actors v2 to v2.3.6
arajasek Dec 14, 2021
5bc4ee2
Deps: Update go-ds-badger2 to v0.1.2
arajasek Dec 14, 2021
46d8ae4
Deps: Update go-ipld-prime to v0.14.3
arajasek Dec 14, 2021
3f703ff
Deps: Update go-car/v2 to v2.1.1
arajasek Dec 14, 2021
69495f5
Deps: Update dagstore to v0.4.4
arajasek Dec 14, 2021
bcd2c71
Deps: Update go-storedcounter to v0.1.0
arajasek Dec 14, 2021
8935c43
Deps: Update go-ipld-cbor to v0.0.6
arajasek Dec 14, 2021
02b00c0
Deps: Update go-fil-markets to v1.13.5
arajasek Dec 14, 2021
7fb5902
Deps: Update lotus-soup to point to tagged releases
arajasek Dec 14, 2021
bdd56d2
Deps: Update go-car to v0.3.3
arajasek Dec 14, 2021
0e2278c
Merge branch 'master' into deps/update-ctx-dsbs
arajasek Dec 14, 2021
62de84d
Deps: Update drand to 1.3.0
arajasek Dec 15, 2021
dd327f0
plumb more contexts
vyzo Dec 17, 2021
6ba2533
fix lotus-shed
vyzo Dec 17, 2021
cd266a0
fix tests
vyzo Dec 17, 2021
122b319
don't update ffi
magik6k Dec 17, 2021
976a3a5
fix blockstore test contexts
vyzo Dec 17, 2021
bc384c0
Merge remote-tracking branch 'origin/master' into deps/update-ctx-dsbs
magik6k Dec 17, 2021
66f8f8a
fix shed
magik6k Dec 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions blockstore/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,35 @@ func NewAPIBlockstore(cio ChainIO) Blockstore {
return Adapt(bs) // return an adapted blockstore.
}

func (a *apiBlockstore) DeleteBlock(cid.Cid) error {
func (a *apiBlockstore) DeleteBlock(context.Context, cid.Cid) error {
return xerrors.New("not supported")
}

func (a *apiBlockstore) Has(c cid.Cid) (bool, error) {
return a.api.ChainHasObj(context.TODO(), c)
func (a *apiBlockstore) Has(ctx context.Context, c cid.Cid) (bool, error) {
return a.api.ChainHasObj(ctx, c)
}

func (a *apiBlockstore) Get(c cid.Cid) (blocks.Block, error) {
bb, err := a.api.ChainReadObj(context.TODO(), c)
func (a *apiBlockstore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error) {
bb, err := a.api.ChainReadObj(ctx, c)
if err != nil {
return nil, err
}
return blocks.NewBlockWithCid(bb, c)
}

func (a *apiBlockstore) GetSize(c cid.Cid) (int, error) {
bb, err := a.api.ChainReadObj(context.TODO(), c)
func (a *apiBlockstore) GetSize(ctx context.Context, c cid.Cid) (int, error) {
bb, err := a.api.ChainReadObj(ctx, c)
if err != nil {
return 0, err
}
return len(bb), nil
}

func (a *apiBlockstore) Put(blocks.Block) error {
func (a *apiBlockstore) Put(context.Context, blocks.Block) error {
return xerrors.New("not supported")
}

func (a *apiBlockstore) PutMany([]blocks.Block) error {
func (a *apiBlockstore) PutMany(context.Context, []blocks.Block) error {
return xerrors.New("not supported")
}

Expand Down
16 changes: 8 additions & 8 deletions blockstore/badger/blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func (b *Blockstore) Size() (int64, error) {

// View implements blockstore.Viewer, which leverages zero-copy read-only
// access to values.
func (b *Blockstore) View(cid cid.Cid, fn func([]byte) error) error {
func (b *Blockstore) View(ctx context.Context, cid cid.Cid, fn func([]byte) error) error {
if err := b.access(); err != nil {
return err
}
Expand All @@ -552,7 +552,7 @@ func (b *Blockstore) View(cid cid.Cid, fn func([]byte) error) error {
}

// Has implements Blockstore.Has.
func (b *Blockstore) Has(cid cid.Cid) (bool, error) {
func (b *Blockstore) Has(ctx context.Context, cid cid.Cid) (bool, error) {
if err := b.access(); err != nil {
return false, err
}
Expand Down Expand Up @@ -582,7 +582,7 @@ func (b *Blockstore) Has(cid cid.Cid) (bool, error) {
}

// Get implements Blockstore.Get.
func (b *Blockstore) Get(cid cid.Cid) (blocks.Block, error) {
func (b *Blockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) {
if !cid.Defined() {
return nil, blockstore.ErrNotFound
}
Expand Down Expand Up @@ -619,7 +619,7 @@ func (b *Blockstore) Get(cid cid.Cid) (blocks.Block, error) {
}

// GetSize implements Blockstore.GetSize.
func (b *Blockstore) GetSize(cid cid.Cid) (int, error) {
func (b *Blockstore) GetSize(ctx context.Context, cid cid.Cid) (int, error) {
if err := b.access(); err != nil {
return 0, err
}
Expand Down Expand Up @@ -652,7 +652,7 @@ func (b *Blockstore) GetSize(cid cid.Cid) (int, error) {
}

// Put implements Blockstore.Put.
func (b *Blockstore) Put(block blocks.Block) error {
func (b *Blockstore) Put(ctx context.Context, block blocks.Block) error {
if err := b.access(); err != nil {
return err
}
Expand Down Expand Up @@ -691,7 +691,7 @@ func (b *Blockstore) Put(block blocks.Block) error {
}

// PutMany implements Blockstore.PutMany.
func (b *Blockstore) PutMany(blocks []blocks.Block) error {
func (b *Blockstore) PutMany(ctx context.Context, blocks []blocks.Block) error {
if err := b.access(); err != nil {
return err
}
Expand Down Expand Up @@ -755,7 +755,7 @@ func (b *Blockstore) PutMany(blocks []blocks.Block) error {
}

// DeleteBlock implements Blockstore.DeleteBlock.
func (b *Blockstore) DeleteBlock(cid cid.Cid) error {
func (b *Blockstore) DeleteBlock(ctx context.Context, cid cid.Cid) error {
if err := b.access(); err != nil {
return err
}
Expand All @@ -774,7 +774,7 @@ func (b *Blockstore) DeleteBlock(cid cid.Cid) error {
})
}

func (b *Blockstore) DeleteMany(cids []cid.Cid) error {
func (b *Blockstore) DeleteMany(ctx context.Context, cids []cid.Cid) error {
if err := b.access(); err != nil {
return err
}
Expand Down
14 changes: 8 additions & 6 deletions blockstore/badger/blockstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package badgerbs

import (
"bytes"
"context"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -98,6 +99,7 @@ func openBlockstore(optsSupplier func(path string) Options) func(tb testing.TB,
}

func testMove(t *testing.T, optsF func(string) Options) {
ctx := context.Background()
basePath, err := ioutil.TempDir("", "")
if err != nil {
t.Fatal(err)
Expand All @@ -122,7 +124,7 @@ func testMove(t *testing.T, optsF func(string) Options) {
// add some blocks
for i := 0; i < 10; i++ {
blk := blocks.NewBlock([]byte(fmt.Sprintf("some data %d", i)))
err := db.Put(blk)
err := db.Put(ctx, blk)
if err != nil {
t.Fatal(err)
}
Expand All @@ -132,7 +134,7 @@ func testMove(t *testing.T, optsF func(string) Options) {
// delete some of them
for i := 5; i < 10; i++ {
c := have[i].Cid()
err := db.DeleteBlock(c)
err := db.DeleteBlock(ctx, c)
if err != nil {
t.Fatal(err)
}
Expand All @@ -145,7 +147,7 @@ func testMove(t *testing.T, optsF func(string) Options) {
g.Go(func() error {
for i := 10; i < 1000; i++ {
blk := blocks.NewBlock([]byte(fmt.Sprintf("some data %d", i)))
err := db.Put(blk)
err := db.Put(ctx, blk)
if err != nil {
return err
}
Expand All @@ -165,7 +167,7 @@ func testMove(t *testing.T, optsF func(string) Options) {
// now check that we have all the blocks in have and none in the deleted lists
checkBlocks := func() {
for _, blk := range have {
has, err := db.Has(blk.Cid())
has, err := db.Has(ctx, blk.Cid())
if err != nil {
t.Fatal(err)
}
Expand All @@ -174,7 +176,7 @@ func testMove(t *testing.T, optsF func(string) Options) {
t.Fatal("missing block")
}

blk2, err := db.Get(blk.Cid())
blk2, err := db.Get(ctx, blk.Cid())
if err != nil {
t.Fatal(err)
}
Expand All @@ -185,7 +187,7 @@ func testMove(t *testing.T, optsF func(string) Options) {
}

for _, c := range deleted {
has, err := db.Has(c)
has, err := db.Has(ctx, c)
if err != nil {
t.Fatal(err)
}
Expand Down
Loading