Skip to content

Commit

Permalink
rename blockstores.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Nov 16, 2020
1 parent 841ddac commit 66336b9
Show file tree
Hide file tree
Showing 37 changed files with 95 additions and 95 deletions.
6 changes: 3 additions & 3 deletions api/apibstore/apibstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type apiBStore struct {
api ChainIO
}

var _ blockstore.LotusBlockstore = (*apiBStore)(nil)
var _ blockstore.Blockstore = (*apiBStore)(nil)

func NewAPIBlockstore(cio ChainIO) blockstore.LotusBlockstore {
func NewAPIBlockstore(cio ChainIO) blockstore.Blockstore {
return &apiBStore{
api: cio,
}
Expand Down Expand Up @@ -75,4 +75,4 @@ func (a *apiBStore) HashOnRead(enabled bool) {
return
}

var _ blockstore.LotusBlockstore = &apiBStore{}
var _ blockstore.Blockstore = &apiBStore{}
4 changes: 2 additions & 2 deletions chain/events/state/mock/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
)

type MockAPI struct {
bs blockstore.LotusBlockstore
bs blockstore.Blockstore

lk sync.Mutex
ts map[types.TipSetKey]*types.Actor
stateGetActorCalled int
}

func NewMockAPI(bs blockstore.LotusBlockstore) *MockAPI {
func NewMockAPI(bs blockstore.Blockstore) *MockAPI {
return &MockAPI{
bs: bs,
ts: make(map[types.TipSetKey]*types.Actor),
Expand Down
6 changes: 3 additions & 3 deletions chain/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var ValidWpostForTesting = []proof2.PoStProof{{
type ChainGen struct {
msgsPerBlock int

bs blockstore.LotusBlockstore
bs blockstore.Blockstore

cs *store.ChainStore

Expand Down Expand Up @@ -86,11 +86,11 @@ type ChainGen struct {
}

type mybs struct {
blockstore.LotusBlockstore
blockstore.Blockstore
}

func (m mybs) Get(c cid.Cid) (block.Block, error) {
b, err := m.LotusBlockstore.Get(c)
b, err := m.Blockstore.Get(c)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/f00_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)

func SetupSystemActor(bs bstore.LotusBlockstore) (*types.Actor, error) {
func SetupSystemActor(bs bstore.Blockstore) (*types.Actor, error) {
var st system.State

cst := cbor.NewCborStore(bs)
Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/f01_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)

func SetupInitActor(bs bstore.LotusBlockstore, netname string, initialActors []genesis.Actor, rootVerifier genesis.Actor) (int64, *types.Actor, map[address.Address]address.Address, error) {
func SetupInitActor(bs bstore.Blockstore, netname string, initialActors []genesis.Actor, rootVerifier genesis.Actor) (int64, *types.Actor, map[address.Address]address.Address, error) {
if len(initialActors) > MaxAccounts {
return 0, nil, nil, xerrors.New("too many initial actors")
}
Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/f02_reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)

func SetupRewardActor(bs bstore.LotusBlockstore, qaPower big.Int) (*types.Actor, error) {
func SetupRewardActor(bs bstore.Blockstore, qaPower big.Int) (*types.Actor, error) {
cst := cbor.NewCborStore(bs)

st := reward0.ConstructState(qaPower)
Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/f03_cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)

func SetupCronActor(bs bstore.LotusBlockstore) (*types.Actor, error) {
func SetupCronActor(bs bstore.Blockstore) (*types.Actor, error) {
cst := cbor.NewCborStore(bs)
cas := cron.ConstructState(cron.BuiltInEntries())

Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/f04_power.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)

func SetupStoragePowerActor(bs bstore.LotusBlockstore) (*types.Actor, error) {
func SetupStoragePowerActor(bs bstore.Blockstore) (*types.Actor, error) {
store := adt.WrapStore(context.TODO(), cbor.NewCborStore(bs))
emptyMap, err := adt.MakeEmptyMap(store).Root()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/f05_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)

func SetupStorageMarketActor(bs bstore.LotusBlockstore) (*types.Actor, error) {
func SetupStorageMarketActor(bs bstore.Blockstore) (*types.Actor, error) {
store := adt.WrapStore(context.TODO(), cbor.NewCborStore(bs))

a, err := adt.MakeEmptyArray(store).Root()
Expand Down
2 changes: 1 addition & 1 deletion chain/gen/genesis/f06_vreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func init() {
RootVerifierID = idk
}

func SetupVerifiedRegistryActor(bs bstore.LotusBlockstore) (*types.Actor, error) {
func SetupVerifiedRegistryActor(bs bstore.Blockstore) (*types.Actor, error) {
store := adt.WrapStore(context.TODO(), cbor.NewCborStore(bs))

h, err := adt.MakeEmptyMap(store).Root()
Expand Down
6 changes: 3 additions & 3 deletions chain/gen/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Genesis: {
*/

func MakeInitialStateTree(ctx context.Context, bs bstore.LotusBlockstore, template genesis.Template) (*state.StateTree, map[address.Address]address.Address, error) {
func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template genesis.Template) (*state.StateTree, map[address.Address]address.Address, error) {
// Create empty state tree

cst := cbor.NewCborStore(bs)
Expand Down Expand Up @@ -333,7 +333,7 @@ func createAccountActor(ctx context.Context, cst cbor.IpldStore, state *state.St
return nil
}

func createMultisigAccount(ctx context.Context, bs bstore.LotusBlockstore, cst cbor.IpldStore, state *state.StateTree, ida address.Address, info genesis.Actor, keyIDs map[address.Address]address.Address) error {
func createMultisigAccount(ctx context.Context, bs bstore.Blockstore, cst cbor.IpldStore, state *state.StateTree, ida address.Address, info genesis.Actor, keyIDs map[address.Address]address.Address) error {
if info.Type != genesis.TMultisig {
return fmt.Errorf("can only call createMultisigAccount with multisig Actor info")
}
Expand Down Expand Up @@ -467,7 +467,7 @@ func VerifyPreSealedData(ctx context.Context, cs *store.ChainStore, stateroot ci
return st, nil
}

func MakeGenesisBlock(ctx context.Context, j journal.Journal, bs bstore.LotusBlockstore, sys vm.SyscallBuilder, template genesis.Template) (*GenesisBootstrap, error) {
func MakeGenesisBlock(ctx context.Context, j journal.Journal, bs bstore.Blockstore, sys vm.SyscallBuilder, template genesis.Template) (*GenesisBootstrap, error) {
if j == nil {
j = journal.NilJournal()
}
Expand Down
18 changes: 9 additions & 9 deletions chain/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ type HeadChangeEvt struct {
// 1. a tipset cache
// 2. a block => messages references cache.
type ChainStore struct {
chainBlockstore bstore.LotusBlockstore
stateBlockstore bstore.LotusBlockstore
chainBlockstore bstore.Blockstore
stateBlockstore bstore.Blockstore
metadataDs dstore.Batching

chainLocalBlockstore bstore.LotusBlockstore
chainLocalBlockstore bstore.Blockstore

heaviestLk sync.Mutex
heaviest *types.TipSet
Expand All @@ -137,7 +137,7 @@ type ChainStore struct {
}

// chainLocalBlockstore is guaranteed to fail Get* if requested block isn't stored locally
func NewChainStore(chainBs bstore.LotusBlockstore, stateBs bstore.LotusBlockstore, ds dstore.Batching, vmcalls vm.SyscallBuilder, j journal.Journal) *ChainStore {
func NewChainStore(chainBs bstore.Blockstore, stateBs bstore.Blockstore, ds dstore.Batching, vmcalls vm.SyscallBuilder, j journal.Journal) *ChainStore {
c, _ := lru.NewARC(DefaultMsgMetaCacheSize)
tsc, _ := lru.NewARC(DefaultTipSetCacheSize)
if j == nil {
Expand Down Expand Up @@ -747,7 +747,7 @@ type storable interface {
ToStorageBlock() (block.Block, error)
}

func PutMessage(bs bstore.LotusBlockstore, m storable) (cid.Cid, error) {
func PutMessage(bs bstore.Blockstore, m storable) (cid.Cid, error) {
b, err := m.ToStorageBlock()
if err != nil {
return cid.Undef, err
Expand Down Expand Up @@ -1108,18 +1108,18 @@ func (cs *ChainStore) LoadSignedMessagesFromCids(cids []cid.Cid) ([]*types.Signe
// ChainBlockstore returns the chain blockstore. Currently the chain and state
// // stores are both backed by the same physical store, albeit with different
// // caching policies, but in the future they will segregate.
func (cs *ChainStore) ChainBlockstore() bstore.LotusBlockstore {
func (cs *ChainStore) ChainBlockstore() bstore.Blockstore {
return cs.chainBlockstore
}

// StateBlockstore returns the state blockstore. Currently the chain and state
// stores are both backed by the same physical store, albeit with different
// caching policies, but in the future they will segregate.
func (cs *ChainStore) StateBlockstore() bstore.LotusBlockstore {
func (cs *ChainStore) StateBlockstore() bstore.Blockstore {
return cs.stateBlockstore
}

func ActorStore(ctx context.Context, bs bstore.LotusBlockstore) adt.Store {
func ActorStore(ctx context.Context, bs bstore.Blockstore) adt.Store {
return adt.WrapStore(ctx, cbor.NewCborStore(bs))
}

Expand Down Expand Up @@ -1276,7 +1276,7 @@ func (cs *ChainStore) GetTipsetByHeight(ctx context.Context, h abi.ChainEpoch, t
return cs.LoadTipSet(lbts.Parents())
}

func recurseLinks(bs bstore.LotusBlockstore, walked *cid.Set, root cid.Cid, in []cid.Cid) ([]cid.Cid, error) {
func recurseLinks(bs bstore.Blockstore, walked *cid.Set, root cid.Cid, in []cid.Cid) ([]cid.Cid, error) {
if root.Prefix().Codec != cid.DagCBOR {
return in, nil
}
Expand Down
4 changes: 2 additions & 2 deletions chain/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (syncer *Syncer) InformNewBlock(from peer.ID, blk *types.FullBlock) bool {
return syncer.InformNewHead(from, fts)
}

func copyBlockstore(ctx context.Context, from, to bstore.LotusBlockstore) error {
func copyBlockstore(ctx context.Context, from, to bstore.Blockstore) error {
ctx, span := trace.StartSpan(ctx, "copyBlockstore")
defer span.End()

Expand Down Expand Up @@ -1641,7 +1641,7 @@ func (syncer *Syncer) fetchMessages(ctx context.Context, headers []*types.TipSet
return batch, nil
}

func persistMessages(ctx context.Context, bs bstore.LotusBlockstore, bst *exchange.CompactedMessages) error {
func persistMessages(ctx context.Context, bs bstore.Blockstore, bst *exchange.CompactedMessages) error {
_, span := trace.StartSpan(ctx, "persistMessages")
defer span.End()

Expand Down
6 changes: 3 additions & 3 deletions chain/vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ type VMOpts struct {
StateBase cid.Cid
Epoch abi.ChainEpoch
Rand Rand
Bstore bstore.LotusBlockstore
Bstore bstore.Blockstore
Syscalls SyscallBuilder
CircSupplyCalc CircSupplyCalculator
NtwkVersion NtwkVersionGetter // TODO: stebalien: In what cases do we actually need this? It seems like even when creating new networks we want to use the 'global'/build-default version getter
Expand Down Expand Up @@ -668,7 +668,7 @@ func linksForObj(blk block.Block, cb func(cid.Cid)) error {
}
}

func Copy(ctx context.Context, from, to blockstore.LotusBlockstore, root cid.Cid) error {
func Copy(ctx context.Context, from, to blockstore.Blockstore, root cid.Cid) error {
ctx, span := trace.StartSpan(ctx, "vm.Copy") // nolint
defer span.End()

Expand Down Expand Up @@ -708,7 +708,7 @@ func Copy(ctx context.Context, from, to blockstore.LotusBlockstore, root cid.Cid
return nil
}

func copyRec(from, to blockstore.LotusBlockstore, root cid.Cid, cp func(block.Block) error) error {
func copyRec(from, to blockstore.Blockstore, root cid.Cid, cp func(block.Block) error) error {
if root.Prefix().MhType == 0 {
// identity cid, skip
return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-bench/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ var importBenchCmd = &cli.Command{

var (
ds datastore.Batching
bs blockstore.LotusBlockstore
bs blockstore.Blockstore
err error
)

Expand Down
18 changes: 9 additions & 9 deletions cmd/tvx/stores.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Stores struct {
CBORStore cbor.IpldStore
ADTStore adt.Store
Datastore ds.Batching
Blockstore blockstore.LotusBlockstore
Blockstore blockstore.Blockstore
BlockService blockservice.BlockService
Exchange exchange.Interface
DAGService format.DAGService
Expand All @@ -43,15 +43,15 @@ type Stores struct {
func NewProxyingStores(ctx context.Context, api api.FullNode) *Stores {
ds := dssync.MutexWrap(ds.NewMapDatastore())
bs := &proxyingBlockstore{
ctx: ctx,
api: api,
LotusBlockstore: blockstore.NewFromDatastore(ds),
ctx: ctx,
api: api,
Blockstore: blockstore.NewFromDatastore(ds),
}
return NewStores(ctx, ds, bs)
}

// NewStores creates a non-proxying set of Stores.
func NewStores(ctx context.Context, ds ds.Batching, bs blockstore.LotusBlockstore) *Stores {
func NewStores(ctx context.Context, ds ds.Batching, bs blockstore.Blockstore) *Stores {
var (
cborstore = cbor.NewCborStore(bs)
offl = offline.Exchange(bs)
Expand Down Expand Up @@ -91,7 +91,7 @@ type proxyingBlockstore struct {
tracing bool
traced map[cid.Cid]struct{}

blockstore.LotusBlockstore
blockstore.Blockstore
}

var _ TracingBlockstore = (*proxyingBlockstore)(nil)
Expand Down Expand Up @@ -119,7 +119,7 @@ func (pb *proxyingBlockstore) Get(cid cid.Cid) (blocks.Block, error) {
}
pb.lk.Unlock()

if block, err := pb.LotusBlockstore.Get(cid); err == nil {
if block, err := pb.Blockstore.Get(cid); err == nil {
return block, err
}

Expand All @@ -133,7 +133,7 @@ func (pb *proxyingBlockstore) Get(cid cid.Cid) (blocks.Block, error) {
return nil, err
}

err = pb.LotusBlockstore.Put(block)
err = pb.Blockstore.Put(block)
if err != nil {
return nil, err
}
Expand All @@ -147,5 +147,5 @@ func (pb *proxyingBlockstore) Put(block blocks.Block) error {
pb.traced[block.Cid()] = struct{}{}
}
pb.lk.Unlock()
return pb.LotusBlockstore.Put(block)
return pb.Blockstore.Put(block)
}
4 changes: 2 additions & 2 deletions conformance/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type ExecuteTipsetResult struct {
// This method returns the the receipts root, the poststate root, and the VM
// message results. The latter _include_ implicit messages, such as cron ticks
// and reward withdrawal per miner.
func (d *Driver) ExecuteTipset(bs blockstore.LotusBlockstore, ds ds.Batching, preroot cid.Cid, parentEpoch abi.ChainEpoch, tipset *schema.Tipset, execEpoch abi.ChainEpoch) (*ExecuteTipsetResult, error) {
func (d *Driver) ExecuteTipset(bs blockstore.Blockstore, ds ds.Batching, preroot cid.Cid, parentEpoch abi.ChainEpoch, tipset *schema.Tipset, execEpoch abi.ChainEpoch) (*ExecuteTipsetResult, error) {
var (
syscalls = vm.Syscalls(ffiwrapper.ProofVerifier)
vmRand = NewFixedRand()
Expand Down Expand Up @@ -156,7 +156,7 @@ type ExecuteMessageParams struct {
}

// ExecuteMessage executes a conformance test vector message in a temporary VM.
func (d *Driver) ExecuteMessage(bs blockstore.LotusBlockstore, params ExecuteMessageParams) (*vm.ApplyRet, cid.Cid, error) {
func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, params ExecuteMessageParams) (*vm.ApplyRet, cid.Cid, error) {
if !d.vmFlush {
// do not flush the VM, just the state tree; this should be used with
// LOTUS_DISABLE_VM_BUF enabled, so writes will anyway be visible.
Expand Down
6 changes: 3 additions & 3 deletions conformance/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func AssertMsgResult(r Reporter, expected *schema.Receipt, actual *vm.ApplyRet,
}
}

func dumpThreeWayStateDiff(r Reporter, vector *schema.TestVector, bs blockstore.LotusBlockstore, actual cid.Cid) {
func dumpThreeWayStateDiff(r Reporter, vector *schema.TestVector, bs blockstore.Blockstore, actual cid.Cid) {
// check if statediff exists; if not, skip.
if err := exec.Command("statediff", "--help").Run(); err != nil {
r.Log("could not dump 3-way state tree diff upon test failure: statediff command not found")
Expand Down Expand Up @@ -213,7 +213,7 @@ func dumpThreeWayStateDiff(r Reporter, vector *schema.TestVector, bs blockstore.

// writeStateToTempCAR writes the provided roots to a temporary CAR that'll be
// cleaned up via t.Cleanup(). It returns the full path of the temp file.
func writeStateToTempCAR(bs blockstore.LotusBlockstore, roots ...cid.Cid) (string, error) {
func writeStateToTempCAR(bs blockstore.Blockstore, roots ...cid.Cid) (string, error) {
tmp, err := ioutil.TempFile("", "lotus-tests-*.car")
if err != nil {
return "", fmt.Errorf("failed to create temp file to dump CAR for diffing: %w", err)
Expand Down Expand Up @@ -248,7 +248,7 @@ func writeStateToTempCAR(bs blockstore.LotusBlockstore, roots ...cid.Cid) (strin
return tmp.Name(), nil
}

func LoadVectorCAR(vectorCAR schema.Base64EncodedBytes) (blockstore.LotusBlockstore, error) {
func LoadVectorCAR(vectorCAR schema.Base64EncodedBytes) (blockstore.Blockstore, error) {
bs := blockstore.NewTemporary()

// Read the base64-encoded CAR from the vector, and inflate the gzip.
Expand Down
2 changes: 1 addition & 1 deletion lib/blockstore/badger/blockstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type Blockstore struct {
prefixLen int
}

var _ blockstore.LotusBlockstore = (*Blockstore)(nil)
var _ blockstore.Blockstore = (*Blockstore)(nil)
var _ blockstore.Viewer = (*Blockstore)(nil)
var _ io.Closer = (*Blockstore)(nil)

Expand Down
Loading

0 comments on commit 66336b9

Please sign in to comment.