diff --git a/client/db.go b/client/db.go index e52dfed60a..9f54b72108 100644 --- a/client/db.go +++ b/client/db.go @@ -43,12 +43,12 @@ type DB interface { NewConcurrentTxn(context.Context, bool) (datastore.Txn, error) // Root returns the underlying root store, within which all data managed by DefraDB is held. - Root() datastore.RootStore + Root() datastore.Rootstore // Blockstore returns the blockstore, within which all blocks (commits) managed by DefraDB are held. // // It sits within the rootstore returned by [Root]. - Blockstore() datastore.DAGStore + Blockstore() datastore.Blockstore // Peerstore returns the peerstore where known host information is stored. // diff --git a/client/mocks/db.go b/client/mocks/db.go index c56af31167..0d832e7d00 100644 --- a/client/mocks/db.go +++ b/client/mocks/db.go @@ -285,15 +285,15 @@ func (_c *DB_BasicImport_Call) RunAndReturn(run func(context.Context, string) er } // Blockstore provides a mock function with given fields: -func (_m *DB) Blockstore() datastore.DAGStore { +func (_m *DB) Blockstore() datastore.Blockstore { ret := _m.Called() - var r0 datastore.DAGStore - if rf, ok := ret.Get(0).(func() datastore.DAGStore); ok { + var r0 datastore.Blockstore + if rf, ok := ret.Get(0).(func() datastore.Blockstore); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(datastore.DAGStore) + r0 = ret.Get(0).(datastore.Blockstore) } } @@ -317,12 +317,12 @@ func (_c *DB_Blockstore_Call) Run(run func()) *DB_Blockstore_Call { return _c } -func (_c *DB_Blockstore_Call) Return(_a0 datastore.DAGStore) *DB_Blockstore_Call { +func (_c *DB_Blockstore_Call) Return(_a0 datastore.Blockstore) *DB_Blockstore_Call { _c.Call.Return(_a0) return _c } -func (_c *DB_Blockstore_Call) RunAndReturn(run func() datastore.DAGStore) *DB_Blockstore_Call { +func (_c *DB_Blockstore_Call) RunAndReturn(run func() datastore.Blockstore) *DB_Blockstore_Call { _c.Call.Return(run) return _c } @@ -1130,15 +1130,15 @@ func (_c *DB_PrintDump_Call) RunAndReturn(run func(context.Context) error) *DB_P } // Root provides a mock function with given fields: -func (_m *DB) Root() datastore.RootStore { +func (_m *DB) Root() datastore.Rootstore { ret := _m.Called() - var r0 datastore.RootStore - if rf, ok := ret.Get(0).(func() datastore.RootStore); ok { + var r0 datastore.Rootstore + if rf, ok := ret.Get(0).(func() datastore.Rootstore); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(datastore.RootStore) + r0 = ret.Get(0).(datastore.Rootstore) } } @@ -1162,12 +1162,12 @@ func (_c *DB_Root_Call) Run(run func()) *DB_Root_Call { return _c } -func (_c *DB_Root_Call) Return(_a0 datastore.RootStore) *DB_Root_Call { +func (_c *DB_Root_Call) Return(_a0 datastore.Rootstore) *DB_Root_Call { _c.Call.Return(_a0) return _c } -func (_c *DB_Root_Call) RunAndReturn(run func() datastore.RootStore) *DB_Root_Call { +func (_c *DB_Root_Call) RunAndReturn(run func() datastore.Rootstore) *DB_Root_Call { _c.Call.Return(run) return _c } diff --git a/datastore/blockstore.go b/datastore/blockstore.go index f9f92198cd..408e209eff 100644 --- a/datastore/blockstore.go +++ b/datastore/blockstore.go @@ -62,7 +62,7 @@ type bstore struct { } var _ blockstore.Blockstore = (*bstore)(nil) -var _ DAGStore = (*bstore)(nil) +var _ Blockstore = (*bstore)(nil) // AsIPLDStorage returns an IPLDStorage instance. // diff --git a/datastore/mocks/root_store.go b/datastore/mocks/root_store.go index 836a059f68..6695965c0d 100644 --- a/datastore/mocks/root_store.go +++ b/datastore/mocks/root_store.go @@ -12,21 +12,21 @@ import ( query "github.com/ipfs/go-datastore/query" ) -// RootStore is an autogenerated mock type for the RootStore type -type RootStore struct { +// Rootstore is an autogenerated mock type for the Rootstore type +type Rootstore struct { mock.Mock } -type RootStore_Expecter struct { +type Rootstore_Expecter struct { mock *mock.Mock } -func (_m *RootStore) EXPECT() *RootStore_Expecter { - return &RootStore_Expecter{mock: &_m.Mock} +func (_m *Rootstore) EXPECT() *Rootstore_Expecter { + return &Rootstore_Expecter{mock: &_m.Mock} } // Batch provides a mock function with given fields: ctx -func (_m *RootStore) Batch(ctx context.Context) (datastore.Batch, error) { +func (_m *Rootstore) Batch(ctx context.Context) (datastore.Batch, error) { ret := _m.Called(ctx) var r0 datastore.Batch @@ -51,36 +51,36 @@ func (_m *RootStore) Batch(ctx context.Context) (datastore.Batch, error) { return r0, r1 } -// RootStore_Batch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Batch' -type RootStore_Batch_Call struct { +// Rootstore_Batch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Batch' +type Rootstore_Batch_Call struct { *mock.Call } // Batch is a helper method to define mock.On call // - ctx context.Context -func (_e *RootStore_Expecter) Batch(ctx interface{}) *RootStore_Batch_Call { - return &RootStore_Batch_Call{Call: _e.mock.On("Batch", ctx)} +func (_e *Rootstore_Expecter) Batch(ctx interface{}) *Rootstore_Batch_Call { + return &Rootstore_Batch_Call{Call: _e.mock.On("Batch", ctx)} } -func (_c *RootStore_Batch_Call) Run(run func(ctx context.Context)) *RootStore_Batch_Call { +func (_c *Rootstore_Batch_Call) Run(run func(ctx context.Context)) *Rootstore_Batch_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context)) }) return _c } -func (_c *RootStore_Batch_Call) Return(_a0 datastore.Batch, _a1 error) *RootStore_Batch_Call { +func (_c *Rootstore_Batch_Call) Return(_a0 datastore.Batch, _a1 error) *Rootstore_Batch_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *RootStore_Batch_Call) RunAndReturn(run func(context.Context) (datastore.Batch, error)) *RootStore_Batch_Call { +func (_c *Rootstore_Batch_Call) RunAndReturn(run func(context.Context) (datastore.Batch, error)) *Rootstore_Batch_Call { _c.Call.Return(run) return _c } // Close provides a mock function with given fields: -func (_m *RootStore) Close() error { +func (_m *Rootstore) Close() error { ret := _m.Called() var r0 error @@ -93,35 +93,35 @@ func (_m *RootStore) Close() error { return r0 } -// RootStore_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' -type RootStore_Close_Call struct { +// Rootstore_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type Rootstore_Close_Call struct { *mock.Call } // Close is a helper method to define mock.On call -func (_e *RootStore_Expecter) Close() *RootStore_Close_Call { - return &RootStore_Close_Call{Call: _e.mock.On("Close")} +func (_e *Rootstore_Expecter) Close() *Rootstore_Close_Call { + return &Rootstore_Close_Call{Call: _e.mock.On("Close")} } -func (_c *RootStore_Close_Call) Run(run func()) *RootStore_Close_Call { +func (_c *Rootstore_Close_Call) Run(run func()) *Rootstore_Close_Call { _c.Call.Run(func(args mock.Arguments) { run() }) return _c } -func (_c *RootStore_Close_Call) Return(_a0 error) *RootStore_Close_Call { +func (_c *Rootstore_Close_Call) Return(_a0 error) *Rootstore_Close_Call { _c.Call.Return(_a0) return _c } -func (_c *RootStore_Close_Call) RunAndReturn(run func() error) *RootStore_Close_Call { +func (_c *Rootstore_Close_Call) RunAndReturn(run func() error) *Rootstore_Close_Call { _c.Call.Return(run) return _c } // Delete provides a mock function with given fields: ctx, key -func (_m *RootStore) Delete(ctx context.Context, key datastore.Key) error { +func (_m *Rootstore) Delete(ctx context.Context, key datastore.Key) error { ret := _m.Called(ctx, key) var r0 error @@ -134,37 +134,37 @@ func (_m *RootStore) Delete(ctx context.Context, key datastore.Key) error { return r0 } -// RootStore_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' -type RootStore_Delete_Call struct { +// Rootstore_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type Rootstore_Delete_Call struct { *mock.Call } // Delete is a helper method to define mock.On call // - ctx context.Context // - key datastore.Key -func (_e *RootStore_Expecter) Delete(ctx interface{}, key interface{}) *RootStore_Delete_Call { - return &RootStore_Delete_Call{Call: _e.mock.On("Delete", ctx, key)} +func (_e *Rootstore_Expecter) Delete(ctx interface{}, key interface{}) *Rootstore_Delete_Call { + return &Rootstore_Delete_Call{Call: _e.mock.On("Delete", ctx, key)} } -func (_c *RootStore_Delete_Call) Run(run func(ctx context.Context, key datastore.Key)) *RootStore_Delete_Call { +func (_c *Rootstore_Delete_Call) Run(run func(ctx context.Context, key datastore.Key)) *Rootstore_Delete_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(datastore.Key)) }) return _c } -func (_c *RootStore_Delete_Call) Return(_a0 error) *RootStore_Delete_Call { +func (_c *Rootstore_Delete_Call) Return(_a0 error) *Rootstore_Delete_Call { _c.Call.Return(_a0) return _c } -func (_c *RootStore_Delete_Call) RunAndReturn(run func(context.Context, datastore.Key) error) *RootStore_Delete_Call { +func (_c *Rootstore_Delete_Call) RunAndReturn(run func(context.Context, datastore.Key) error) *Rootstore_Delete_Call { _c.Call.Return(run) return _c } // Get provides a mock function with given fields: ctx, key -func (_m *RootStore) Get(ctx context.Context, key datastore.Key) ([]byte, error) { +func (_m *Rootstore) Get(ctx context.Context, key datastore.Key) ([]byte, error) { ret := _m.Called(ctx, key) var r0 []byte @@ -189,37 +189,37 @@ func (_m *RootStore) Get(ctx context.Context, key datastore.Key) ([]byte, error) return r0, r1 } -// RootStore_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' -type RootStore_Get_Call struct { +// Rootstore_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type Rootstore_Get_Call struct { *mock.Call } // Get is a helper method to define mock.On call // - ctx context.Context // - key datastore.Key -func (_e *RootStore_Expecter) Get(ctx interface{}, key interface{}) *RootStore_Get_Call { - return &RootStore_Get_Call{Call: _e.mock.On("Get", ctx, key)} +func (_e *Rootstore_Expecter) Get(ctx interface{}, key interface{}) *Rootstore_Get_Call { + return &Rootstore_Get_Call{Call: _e.mock.On("Get", ctx, key)} } -func (_c *RootStore_Get_Call) Run(run func(ctx context.Context, key datastore.Key)) *RootStore_Get_Call { +func (_c *Rootstore_Get_Call) Run(run func(ctx context.Context, key datastore.Key)) *Rootstore_Get_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(datastore.Key)) }) return _c } -func (_c *RootStore_Get_Call) Return(value []byte, err error) *RootStore_Get_Call { +func (_c *Rootstore_Get_Call) Return(value []byte, err error) *Rootstore_Get_Call { _c.Call.Return(value, err) return _c } -func (_c *RootStore_Get_Call) RunAndReturn(run func(context.Context, datastore.Key) ([]byte, error)) *RootStore_Get_Call { +func (_c *Rootstore_Get_Call) RunAndReturn(run func(context.Context, datastore.Key) ([]byte, error)) *Rootstore_Get_Call { _c.Call.Return(run) return _c } // GetSize provides a mock function with given fields: ctx, key -func (_m *RootStore) GetSize(ctx context.Context, key datastore.Key) (int, error) { +func (_m *Rootstore) GetSize(ctx context.Context, key datastore.Key) (int, error) { ret := _m.Called(ctx, key) var r0 int @@ -242,37 +242,37 @@ func (_m *RootStore) GetSize(ctx context.Context, key datastore.Key) (int, error return r0, r1 } -// RootStore_GetSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSize' -type RootStore_GetSize_Call struct { +// Rootstore_GetSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSize' +type Rootstore_GetSize_Call struct { *mock.Call } // GetSize is a helper method to define mock.On call // - ctx context.Context // - key datastore.Key -func (_e *RootStore_Expecter) GetSize(ctx interface{}, key interface{}) *RootStore_GetSize_Call { - return &RootStore_GetSize_Call{Call: _e.mock.On("GetSize", ctx, key)} +func (_e *Rootstore_Expecter) GetSize(ctx interface{}, key interface{}) *Rootstore_GetSize_Call { + return &Rootstore_GetSize_Call{Call: _e.mock.On("GetSize", ctx, key)} } -func (_c *RootStore_GetSize_Call) Run(run func(ctx context.Context, key datastore.Key)) *RootStore_GetSize_Call { +func (_c *Rootstore_GetSize_Call) Run(run func(ctx context.Context, key datastore.Key)) *Rootstore_GetSize_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(datastore.Key)) }) return _c } -func (_c *RootStore_GetSize_Call) Return(size int, err error) *RootStore_GetSize_Call { +func (_c *Rootstore_GetSize_Call) Return(size int, err error) *Rootstore_GetSize_Call { _c.Call.Return(size, err) return _c } -func (_c *RootStore_GetSize_Call) RunAndReturn(run func(context.Context, datastore.Key) (int, error)) *RootStore_GetSize_Call { +func (_c *Rootstore_GetSize_Call) RunAndReturn(run func(context.Context, datastore.Key) (int, error)) *Rootstore_GetSize_Call { _c.Call.Return(run) return _c } // Has provides a mock function with given fields: ctx, key -func (_m *RootStore) Has(ctx context.Context, key datastore.Key) (bool, error) { +func (_m *Rootstore) Has(ctx context.Context, key datastore.Key) (bool, error) { ret := _m.Called(ctx, key) var r0 bool @@ -295,37 +295,37 @@ func (_m *RootStore) Has(ctx context.Context, key datastore.Key) (bool, error) { return r0, r1 } -// RootStore_Has_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Has' -type RootStore_Has_Call struct { +// Rootstore_Has_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Has' +type Rootstore_Has_Call struct { *mock.Call } // Has is a helper method to define mock.On call // - ctx context.Context // - key datastore.Key -func (_e *RootStore_Expecter) Has(ctx interface{}, key interface{}) *RootStore_Has_Call { - return &RootStore_Has_Call{Call: _e.mock.On("Has", ctx, key)} +func (_e *Rootstore_Expecter) Has(ctx interface{}, key interface{}) *Rootstore_Has_Call { + return &Rootstore_Has_Call{Call: _e.mock.On("Has", ctx, key)} } -func (_c *RootStore_Has_Call) Run(run func(ctx context.Context, key datastore.Key)) *RootStore_Has_Call { +func (_c *Rootstore_Has_Call) Run(run func(ctx context.Context, key datastore.Key)) *Rootstore_Has_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(datastore.Key)) }) return _c } -func (_c *RootStore_Has_Call) Return(exists bool, err error) *RootStore_Has_Call { +func (_c *Rootstore_Has_Call) Return(exists bool, err error) *Rootstore_Has_Call { _c.Call.Return(exists, err) return _c } -func (_c *RootStore_Has_Call) RunAndReturn(run func(context.Context, datastore.Key) (bool, error)) *RootStore_Has_Call { +func (_c *Rootstore_Has_Call) RunAndReturn(run func(context.Context, datastore.Key) (bool, error)) *Rootstore_Has_Call { _c.Call.Return(run) return _c } // NewTransaction provides a mock function with given fields: ctx, readOnly -func (_m *RootStore) NewTransaction(ctx context.Context, readOnly bool) (datastore.Txn, error) { +func (_m *Rootstore) NewTransaction(ctx context.Context, readOnly bool) (datastore.Txn, error) { ret := _m.Called(ctx, readOnly) var r0 datastore.Txn @@ -350,37 +350,37 @@ func (_m *RootStore) NewTransaction(ctx context.Context, readOnly bool) (datasto return r0, r1 } -// RootStore_NewTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewTransaction' -type RootStore_NewTransaction_Call struct { +// Rootstore_NewTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewTransaction' +type Rootstore_NewTransaction_Call struct { *mock.Call } // NewTransaction is a helper method to define mock.On call // - ctx context.Context // - readOnly bool -func (_e *RootStore_Expecter) NewTransaction(ctx interface{}, readOnly interface{}) *RootStore_NewTransaction_Call { - return &RootStore_NewTransaction_Call{Call: _e.mock.On("NewTransaction", ctx, readOnly)} +func (_e *Rootstore_Expecter) NewTransaction(ctx interface{}, readOnly interface{}) *Rootstore_NewTransaction_Call { + return &Rootstore_NewTransaction_Call{Call: _e.mock.On("NewTransaction", ctx, readOnly)} } -func (_c *RootStore_NewTransaction_Call) Run(run func(ctx context.Context, readOnly bool)) *RootStore_NewTransaction_Call { +func (_c *Rootstore_NewTransaction_Call) Run(run func(ctx context.Context, readOnly bool)) *Rootstore_NewTransaction_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(bool)) }) return _c } -func (_c *RootStore_NewTransaction_Call) Return(_a0 datastore.Txn, _a1 error) *RootStore_NewTransaction_Call { +func (_c *Rootstore_NewTransaction_Call) Return(_a0 datastore.Txn, _a1 error) *Rootstore_NewTransaction_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *RootStore_NewTransaction_Call) RunAndReturn(run func(context.Context, bool) (datastore.Txn, error)) *RootStore_NewTransaction_Call { +func (_c *Rootstore_NewTransaction_Call) RunAndReturn(run func(context.Context, bool) (datastore.Txn, error)) *Rootstore_NewTransaction_Call { _c.Call.Return(run) return _c } // Put provides a mock function with given fields: ctx, key, value -func (_m *RootStore) Put(ctx context.Context, key datastore.Key, value []byte) error { +func (_m *Rootstore) Put(ctx context.Context, key datastore.Key, value []byte) error { ret := _m.Called(ctx, key, value) var r0 error @@ -393,8 +393,8 @@ func (_m *RootStore) Put(ctx context.Context, key datastore.Key, value []byte) e return r0 } -// RootStore_Put_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Put' -type RootStore_Put_Call struct { +// Rootstore_Put_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Put' +type Rootstore_Put_Call struct { *mock.Call } @@ -402,29 +402,29 @@ type RootStore_Put_Call struct { // - ctx context.Context // - key datastore.Key // - value []byte -func (_e *RootStore_Expecter) Put(ctx interface{}, key interface{}, value interface{}) *RootStore_Put_Call { - return &RootStore_Put_Call{Call: _e.mock.On("Put", ctx, key, value)} +func (_e *Rootstore_Expecter) Put(ctx interface{}, key interface{}, value interface{}) *Rootstore_Put_Call { + return &Rootstore_Put_Call{Call: _e.mock.On("Put", ctx, key, value)} } -func (_c *RootStore_Put_Call) Run(run func(ctx context.Context, key datastore.Key, value []byte)) *RootStore_Put_Call { +func (_c *Rootstore_Put_Call) Run(run func(ctx context.Context, key datastore.Key, value []byte)) *Rootstore_Put_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(datastore.Key), args[2].([]byte)) }) return _c } -func (_c *RootStore_Put_Call) Return(_a0 error) *RootStore_Put_Call { +func (_c *Rootstore_Put_Call) Return(_a0 error) *Rootstore_Put_Call { _c.Call.Return(_a0) return _c } -func (_c *RootStore_Put_Call) RunAndReturn(run func(context.Context, datastore.Key, []byte) error) *RootStore_Put_Call { +func (_c *Rootstore_Put_Call) RunAndReturn(run func(context.Context, datastore.Key, []byte) error) *Rootstore_Put_Call { _c.Call.Return(run) return _c } // Query provides a mock function with given fields: ctx, q -func (_m *RootStore) Query(ctx context.Context, q query.Query) (query.Results, error) { +func (_m *Rootstore) Query(ctx context.Context, q query.Query) (query.Results, error) { ret := _m.Called(ctx, q) var r0 query.Results @@ -449,37 +449,37 @@ func (_m *RootStore) Query(ctx context.Context, q query.Query) (query.Results, e return r0, r1 } -// RootStore_Query_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Query' -type RootStore_Query_Call struct { +// Rootstore_Query_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Query' +type Rootstore_Query_Call struct { *mock.Call } // Query is a helper method to define mock.On call // - ctx context.Context // - q query.Query -func (_e *RootStore_Expecter) Query(ctx interface{}, q interface{}) *RootStore_Query_Call { - return &RootStore_Query_Call{Call: _e.mock.On("Query", ctx, q)} +func (_e *Rootstore_Expecter) Query(ctx interface{}, q interface{}) *Rootstore_Query_Call { + return &Rootstore_Query_Call{Call: _e.mock.On("Query", ctx, q)} } -func (_c *RootStore_Query_Call) Run(run func(ctx context.Context, q query.Query)) *RootStore_Query_Call { +func (_c *Rootstore_Query_Call) Run(run func(ctx context.Context, q query.Query)) *Rootstore_Query_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(query.Query)) }) return _c } -func (_c *RootStore_Query_Call) Return(_a0 query.Results, _a1 error) *RootStore_Query_Call { +func (_c *Rootstore_Query_Call) Return(_a0 query.Results, _a1 error) *Rootstore_Query_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *RootStore_Query_Call) RunAndReturn(run func(context.Context, query.Query) (query.Results, error)) *RootStore_Query_Call { +func (_c *Rootstore_Query_Call) RunAndReturn(run func(context.Context, query.Query) (query.Results, error)) *Rootstore_Query_Call { _c.Call.Return(run) return _c } // Sync provides a mock function with given fields: ctx, prefix -func (_m *RootStore) Sync(ctx context.Context, prefix datastore.Key) error { +func (_m *Rootstore) Sync(ctx context.Context, prefix datastore.Key) error { ret := _m.Called(ctx, prefix) var r0 error @@ -492,42 +492,42 @@ func (_m *RootStore) Sync(ctx context.Context, prefix datastore.Key) error { return r0 } -// RootStore_Sync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sync' -type RootStore_Sync_Call struct { +// Rootstore_Sync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sync' +type Rootstore_Sync_Call struct { *mock.Call } // Sync is a helper method to define mock.On call // - ctx context.Context // - prefix datastore.Key -func (_e *RootStore_Expecter) Sync(ctx interface{}, prefix interface{}) *RootStore_Sync_Call { - return &RootStore_Sync_Call{Call: _e.mock.On("Sync", ctx, prefix)} +func (_e *Rootstore_Expecter) Sync(ctx interface{}, prefix interface{}) *Rootstore_Sync_Call { + return &Rootstore_Sync_Call{Call: _e.mock.On("Sync", ctx, prefix)} } -func (_c *RootStore_Sync_Call) Run(run func(ctx context.Context, prefix datastore.Key)) *RootStore_Sync_Call { +func (_c *Rootstore_Sync_Call) Run(run func(ctx context.Context, prefix datastore.Key)) *Rootstore_Sync_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(datastore.Key)) }) return _c } -func (_c *RootStore_Sync_Call) Return(_a0 error) *RootStore_Sync_Call { +func (_c *Rootstore_Sync_Call) Return(_a0 error) *Rootstore_Sync_Call { _c.Call.Return(_a0) return _c } -func (_c *RootStore_Sync_Call) RunAndReturn(run func(context.Context, datastore.Key) error) *RootStore_Sync_Call { +func (_c *Rootstore_Sync_Call) RunAndReturn(run func(context.Context, datastore.Key) error) *Rootstore_Sync_Call { _c.Call.Return(run) return _c } -// NewRootStore creates a new instance of RootStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// NewRootstore creates a new instance of Rootstore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. -func NewRootStore(t interface { +func NewRootstore(t interface { mock.TestingT Cleanup(func()) -}) *RootStore { - mock := &RootStore{} +}) *Rootstore { + mock := &Rootstore{} mock.Mock.Test(t) t.Cleanup(func() { mock.AssertExpectations(t) }) diff --git a/datastore/mocks/txn.go b/datastore/mocks/txn.go index 711464dc12..8b9d80a1b8 100644 --- a/datastore/mocks/txn.go +++ b/datastore/mocks/txn.go @@ -22,87 +22,87 @@ func (_m *Txn) EXPECT() *Txn_Expecter { return &Txn_Expecter{mock: &_m.Mock} } -// Commit provides a mock function with given fields: ctx -func (_m *Txn) Commit(ctx context.Context) error { - ret := _m.Called(ctx) +// Blockstore provides a mock function with given fields: +func (_m *Txn) Blockstore() datastore.Blockstore { + ret := _m.Called() - var r0 error - if rf, ok := ret.Get(0).(func(context.Context) error); ok { - r0 = rf(ctx) + var r0 datastore.Blockstore + if rf, ok := ret.Get(0).(func() datastore.Blockstore); ok { + r0 = rf() } else { - r0 = ret.Error(0) + if ret.Get(0) != nil { + r0 = ret.Get(0).(datastore.Blockstore) + } } return r0 } -// Txn_Commit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Commit' -type Txn_Commit_Call struct { +// Txn_Blockstore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Blockstore' +type Txn_Blockstore_Call struct { *mock.Call } -// Commit is a helper method to define mock.On call -// - ctx context.Context -func (_e *Txn_Expecter) Commit(ctx interface{}) *Txn_Commit_Call { - return &Txn_Commit_Call{Call: _e.mock.On("Commit", ctx)} +// Blockstore is a helper method to define mock.On call +func (_e *Txn_Expecter) Blockstore() *Txn_Blockstore_Call { + return &Txn_Blockstore_Call{Call: _e.mock.On("Blockstore")} } -func (_c *Txn_Commit_Call) Run(run func(ctx context.Context)) *Txn_Commit_Call { +func (_c *Txn_Blockstore_Call) Run(run func()) *Txn_Blockstore_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) + run() }) return _c } -func (_c *Txn_Commit_Call) Return(_a0 error) *Txn_Commit_Call { +func (_c *Txn_Blockstore_Call) Return(_a0 datastore.Blockstore) *Txn_Blockstore_Call { _c.Call.Return(_a0) return _c } -func (_c *Txn_Commit_Call) RunAndReturn(run func(context.Context) error) *Txn_Commit_Call { +func (_c *Txn_Blockstore_Call) RunAndReturn(run func() datastore.Blockstore) *Txn_Blockstore_Call { _c.Call.Return(run) return _c } -// DAGstore provides a mock function with given fields: -func (_m *Txn) DAGstore() datastore.DAGStore { - ret := _m.Called() +// Commit provides a mock function with given fields: ctx +func (_m *Txn) Commit(ctx context.Context) error { + ret := _m.Called(ctx) - var r0 datastore.DAGStore - if rf, ok := ret.Get(0).(func() datastore.DAGStore); ok { - r0 = rf() + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(datastore.DAGStore) - } + r0 = ret.Error(0) } return r0 } -// Txn_DAGstore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DAGstore' -type Txn_DAGstore_Call struct { +// Txn_Commit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Commit' +type Txn_Commit_Call struct { *mock.Call } -// DAGstore is a helper method to define mock.On call -func (_e *Txn_Expecter) DAGstore() *Txn_DAGstore_Call { - return &Txn_DAGstore_Call{Call: _e.mock.On("DAGstore")} +// Commit is a helper method to define mock.On call +// - ctx context.Context +func (_e *Txn_Expecter) Commit(ctx interface{}) *Txn_Commit_Call { + return &Txn_Commit_Call{Call: _e.mock.On("Commit", ctx)} } -func (_c *Txn_DAGstore_Call) Run(run func()) *Txn_DAGstore_Call { +func (_c *Txn_Commit_Call) Run(run func(ctx context.Context)) *Txn_Commit_Call { _c.Call.Run(func(args mock.Arguments) { - run() + run(args[0].(context.Context)) }) return _c } -func (_c *Txn_DAGstore_Call) Return(_a0 datastore.DAGStore) *Txn_DAGstore_Call { +func (_c *Txn_Commit_Call) Return(_a0 error) *Txn_Commit_Call { _c.Call.Return(_a0) return _c } -func (_c *Txn_DAGstore_Call) RunAndReturn(run func() datastore.DAGStore) *Txn_DAGstore_Call { +func (_c *Txn_Commit_Call) RunAndReturn(run func(context.Context) error) *Txn_Commit_Call { _c.Call.Return(run) return _c } diff --git a/datastore/mocks/utils.go b/datastore/mocks/utils.go index 50131a8538..af3c49fd0c 100644 --- a/datastore/mocks/utils.go +++ b/datastore/mocks/utils.go @@ -36,7 +36,7 @@ func prepareDataStore(t *testing.T) *DSReaderWriter { return dataStore } -func prepareRootStore(t *testing.T) *DSReaderWriter { +func prepareRootstore(t *testing.T) *DSReaderWriter { return NewDSReaderWriter(t) } @@ -73,7 +73,7 @@ func NewTxnWithMultistore(t *testing.T) *MultiStoreTxn { result := &MultiStoreTxn{ Txn: txn, t: t, - MockRootstore: prepareRootStore(t), + MockRootstore: prepareRootstore(t), MockDatastore: prepareDataStore(t), MockHeadstore: prepareHeadStore(t), MockDAGstore: prepareDAGStore(t), @@ -83,7 +83,7 @@ func NewTxnWithMultistore(t *testing.T) *MultiStoreTxn { txn.EXPECT().Rootstore().Return(result.MockRootstore).Maybe() txn.EXPECT().Datastore().Return(result.MockDatastore).Maybe() txn.EXPECT().Headstore().Return(result.MockHeadstore).Maybe() - txn.EXPECT().DAGstore().Return(result.MockDAGstore).Maybe() + txn.EXPECT().Blockstore().Return(result.MockDAGstore).Maybe() txn.EXPECT().Systemstore().Return(result.MockSystemstore).Maybe() return result diff --git a/datastore/multi.go b/datastore/multi.go index bbd333ba19..a70a24a60d 100644 --- a/datastore/multi.go +++ b/datastore/multi.go @@ -32,7 +32,7 @@ type multistore struct { peer DSBatching system DSReaderWriter // block DSReaderWriter - dag DAGStore + dag Blockstore } var _ MultiStore = (*multistore)(nil) @@ -67,8 +67,8 @@ func (ms multistore) Peerstore() DSBatching { return ms.peer } -// DAGstore implements MultiStore. -func (ms multistore) DAGstore() DAGStore { +// Blockstore implements MultiStore. +func (ms multistore) Blockstore() Blockstore { return ms.dag } diff --git a/datastore/store.go b/datastore/store.go index 7954eb5014..66501270d1 100644 --- a/datastore/store.go +++ b/datastore/store.go @@ -24,8 +24,8 @@ var ( log = corelog.NewLogger("store") ) -// RootStore wraps Batching and TxnDatastore requiring datastore to support both batching and transactions. -type RootStore interface { +// Rootstore wraps Batching and TxnDatastore requiring datastore to support both batching and transactions. +type Rootstore interface { ds.Batching ds.TxnDatastore } @@ -47,10 +47,10 @@ type MultiStore interface { // under the /peers namespace Peerstore() DSBatching - // DAGstore is a wrapped root DSReaderWriter - // as a Blockstore, embedded into a DAGStore + // Blockstore is a wrapped root DSReaderWriter + // as a Blockstore, embedded into a Blockstore // under the /blocks namespace - DAGstore() DAGStore + Blockstore() Blockstore // Headstore is a wrapped root DSReaderWriter // under the /system namespace @@ -70,8 +70,8 @@ type DSReaderWriter interface { iterable.Iterable } -// DAGStore proxies the ipld.DAGService under the /core namespace for future-proofing -type DAGStore interface { +// Blockstore proxies the ipld.DAGService under the /core namespace for future-proofing +type Blockstore interface { blockstore.Blockstore AsIPLDStorage() IPLDStorage } diff --git a/http/client.go b/http/client.go index 2843ee4f2d..a0587f0bf6 100644 --- a/http/client.go +++ b/http/client.go @@ -435,11 +435,11 @@ func (c *Client) Close() { // do nothing } -func (c *Client) Root() datastore.RootStore { +func (c *Client) Root() datastore.Rootstore { panic("client side database") } -func (c *Client) Blockstore() datastore.DAGStore { +func (c *Client) Blockstore() datastore.Blockstore { panic("client side database") } diff --git a/http/client_tx.go b/http/client_tx.go index 19e5814b51..a804b934f1 100644 --- a/http/client_tx.go +++ b/http/client_tx.go @@ -99,7 +99,7 @@ func (c *Transaction) Peerstore() datastore.DSBatching { panic("client side transaction") } -func (c *Transaction) DAGstore() datastore.DAGStore { +func (c *Transaction) Blockstore() datastore.Blockstore { panic("client side transaction") } diff --git a/internal/db/db.go b/internal/db/db.go index a6fb37f643..11750e5881 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -55,7 +55,7 @@ const ( type db struct { glock sync.RWMutex - rootstore datastore.RootStore + rootstore datastore.Rootstore multistore datastore.MultiStore events *event.Bus @@ -80,7 +80,7 @@ type db struct { // NewDB creates a new instance of the DB using the given options. func NewDB( ctx context.Context, - rootstore datastore.RootStore, + rootstore datastore.Rootstore, acp immutable.Option[acp.ACP], lens client.LensRegistry, options ...Option, @@ -90,7 +90,7 @@ func NewDB( func newDB( ctx context.Context, - rootstore datastore.RootStore, + rootstore datastore.Rootstore, acp immutable.Option[acp.ACP], lens client.LensRegistry, options ...Option, @@ -148,13 +148,13 @@ func (db *db) NewConcurrentTxn(ctx context.Context, readonly bool) (datastore.Tx } // Root returns the root datastore. -func (db *db) Root() datastore.RootStore { +func (db *db) Root() datastore.Rootstore { return db.rootstore } // Blockstore returns the internal DAG store which contains IPLD blocks. -func (db *db) Blockstore() datastore.DAGStore { - return db.multistore.DAGstore() +func (db *db) Blockstore() datastore.Blockstore { + return db.multistore.Blockstore() } // Peerstore returns the internal DAG store which contains IPLD blocks. diff --git a/internal/db/fetcher/versioned.go b/internal/db/fetcher/versioned.go index 6ce8f94ebc..892b84e329 100644 --- a/internal/db/fetcher/versioned.go +++ b/internal/db/fetcher/versioned.go @@ -86,7 +86,7 @@ type VersionedFetcher struct { ctx context.Context // Transient version store - root datastore.RootStore + root datastore.Rootstore store datastore.Txn dsKey core.DataStoreKey @@ -281,7 +281,7 @@ func (vf *VersionedFetcher) seekNext(c cid.Cid, topParent bool) error { // @body: We could possibly append the DocID to the CID either as a // child key, or an instance on the CID key. - hasLocalBlock, err := vf.store.DAGstore().Has(vf.ctx, c) + hasLocalBlock, err := vf.store.Blockstore().Has(vf.ctx, c) if err != nil { return NewErrVFetcherFailedToFindBlock(err) } @@ -290,13 +290,13 @@ func (vf *VersionedFetcher) seekNext(c cid.Cid, topParent bool) error { return nil } - blk, err := vf.txn.DAGstore().Get(vf.ctx, c) + blk, err := vf.txn.Blockstore().Get(vf.ctx, c) if err != nil { return NewErrVFetcherFailedToGetBlock(err) } // store the block in the local (transient store) - if err := vf.store.DAGstore().Put(vf.ctx, blk); err != nil { + if err := vf.store.Blockstore().Put(vf.ctx, blk); err != nil { return NewErrVFetcherFailedToWriteBlock(err) } @@ -336,7 +336,7 @@ func (vf *VersionedFetcher) seekNext(c cid.Cid, topParent bool) error { } // merge in the state of the IPLD Block identified by CID c into the VersionedFetcher state. -// Requires the CID to already exist in the DAGStore. +// Requires the CID to already exist in the Blockstore. // This function only works for merging Composite MerkleCRDT objects. // // First it checks for the existence of the block, @@ -421,7 +421,7 @@ func (vf *VersionedFetcher) processBlock( func (vf *VersionedFetcher) getDAGBlock(c cid.Cid) (*coreblock.Block, error) { // get Block - blk, err := vf.store.DAGstore().Get(vf.ctx, c) + blk, err := vf.store.Blockstore().Get(vf.ctx, c) if err != nil { return nil, NewErrFailedToGetDagNode(err) } diff --git a/internal/db/index_test.go b/internal/db/index_test.go index b7f4bbfb96..9226f92efd 100644 --- a/internal/db/index_test.go +++ b/internal/db/index_test.go @@ -473,11 +473,11 @@ func TestCreateIndex_IfFailsToCreateTxn_ReturnError(t *testing.T) { testErr := errors.New("test error") - mockedRootStore := mocks.NewRootStore(t) - mockedRootStore.On("Close").Return(nil) + mockedRootstore := mocks.NewRootstore(t) + mockedRootstore.On("Close").Return(nil) - mockedRootStore.EXPECT().NewTransaction(mock.Anything, mock.Anything).Return(nil, testErr) - f.db.rootstore = mockedRootStore + mockedRootstore.EXPECT().NewTransaction(mock.Anything, mock.Anything).Return(nil, testErr) + f.db.rootstore = mockedRootstore _, err := f.users.CreateIndex(f.ctx, getUsersIndexDescOnName()) require.ErrorIs(t, err, testErr) @@ -859,15 +859,15 @@ func TestCollectionGetIndexes_IfFailsToCreateTxn_ShouldNotCache(t *testing.T) { testErr := errors.New("test error") - workingRootStore := f.db.rootstore - mockedRootStore := mocks.NewRootStore(t) - f.db.rootstore = mockedRootStore - mockedRootStore.EXPECT().NewTransaction(mock.Anything, mock.Anything).Return(nil, testErr) + workingRootstore := f.db.rootstore + mockedRootstore := mocks.NewRootstore(t) + f.db.rootstore = mockedRootstore + mockedRootstore.EXPECT().NewTransaction(mock.Anything, mock.Anything).Return(nil, testErr) _, err := f.users.GetIndexes(f.ctx) require.ErrorIs(t, err, testErr) - f.db.rootstore = workingRootStore + f.db.rootstore = workingRootstore indexes, err := f.users.GetIndexes(f.ctx) require.NoError(t, err) @@ -1075,11 +1075,11 @@ func TestDropIndex_IfFailsToCreateTxn_ReturnError(t *testing.T) { testErr := errors.New("test error") - mockedRootStore := mocks.NewRootStore(t) - mockedRootStore.On("Close").Return(nil) + mockedRootstore := mocks.NewRootstore(t) + mockedRootstore.On("Close").Return(nil) - mockedRootStore.EXPECT().NewTransaction(mock.Anything, mock.Anything).Return(nil, testErr) - f.db.rootstore = mockedRootStore + mockedRootstore.EXPECT().NewTransaction(mock.Anything, mock.Anything).Return(nil, testErr) + f.db.rootstore = mockedRootstore err := f.users.DropIndex(f.ctx, testUsersColIndexName) require.ErrorIs(t, err, testErr) diff --git a/internal/db/merge.go b/internal/db/merge.go index e7d4c8252c..278c13ad12 100644 --- a/internal/db/merge.go +++ b/internal/db/merge.go @@ -91,7 +91,7 @@ func (db *db) executeMerge(ctx context.Context, dagMerge event.Merge) error { } ls := cidlink.DefaultLinkSystem() - ls.SetReadStorage(txn.DAGstore().AsIPLDStorage()) + ls.SetReadStorage(txn.Blockstore().AsIPLDStorage()) docID, err := client.NewDocIDFromString(dagMerge.DocID) if err != nil { @@ -409,7 +409,7 @@ func getHeadsAsMergeTarget(ctx context.Context, txn datastore.Txn, dsKey core.Da mt := newMergeTarget() for _, cid := range cids { - b, err := txn.DAGstore().Get(ctx, cid) + b, err := txn.Blockstore().Get(ctx, cid) if err != nil { return mergeTarget{}, err } diff --git a/internal/db/merge_test.go b/internal/db/merge_test.go index f620003bbe..a78fd59983 100644 --- a/internal/db/merge_test.go +++ b/internal/db/merge_test.go @@ -48,7 +48,7 @@ func TestMerge_SingleBranch_NoError(t *testing.T) { require.NoError(t, err) lsys := cidlink.DefaultLinkSystem() - lsys.SetWriteStorage(db.multistore.DAGstore().AsIPLDStorage()) + lsys.SetWriteStorage(db.multistore.Blockstore().AsIPLDStorage()) initialDocState := map[string]any{ "name": "John", @@ -93,7 +93,7 @@ func TestMerge_DualBranch_NoError(t *testing.T) { require.NoError(t, err) lsys := cidlink.DefaultLinkSystem() - lsys.SetWriteStorage(db.multistore.DAGstore().AsIPLDStorage()) + lsys.SetWriteStorage(db.multistore.Blockstore().AsIPLDStorage()) initialDocState := map[string]any{ "name": "John", @@ -151,7 +151,7 @@ func TestMerge_DualBranchWithOneIncomplete_CouldNotFindCID(t *testing.T) { require.NoError(t, err) lsys := cidlink.DefaultLinkSystem() - lsys.SetWriteStorage(db.multistore.DAGstore().AsIPLDStorage()) + lsys.SetWriteStorage(db.multistore.Blockstore().AsIPLDStorage()) initialDocState := map[string]any{ "name": "John", diff --git a/internal/merkle/clock/clock.go b/internal/merkle/clock/clock.go index 06cccb6467..d16d1d6a5b 100644 --- a/internal/merkle/clock/clock.go +++ b/internal/merkle/clock/clock.go @@ -32,8 +32,8 @@ var ( // MerkleClock is a MerkleCRDT clock that can be used to read/write events (deltas) to the clock. type MerkleClock struct { - headstore datastore.DSReaderWriter - dagstore datastore.DAGStore + headstore datastore.DSReaderWriter + blockstore datastore.Blockstore // dagSyncer headset *heads crdt core.ReplicatedData @@ -42,15 +42,15 @@ type MerkleClock struct { // NewMerkleClock returns a new MerkleClock. func NewMerkleClock( headstore datastore.DSReaderWriter, - dagstore datastore.DAGStore, + blockstore datastore.Blockstore, namespace core.HeadStoreKey, crdt core.ReplicatedData, ) *MerkleClock { return &MerkleClock{ - headstore: headstore, - dagstore: dagstore, - headset: NewHeadSet(headstore, namespace), - crdt: crdt, + headstore: headstore, + blockstore: blockstore, + headset: NewHeadSet(headstore, namespace), + crdt: crdt, } } @@ -60,7 +60,7 @@ func (mc *MerkleClock) putBlock( ) (cidlink.Link, error) { nd := block.GenerateNode() lsys := cidlink.DefaultLinkSystem() - lsys.SetWriteStorage(mc.dagstore.AsIPLDStorage()) + lsys.SetWriteStorage(mc.blockstore.AsIPLDStorage()) link, err := lsys.Store(linking.LinkContext{Ctx: ctx}, coreblock.GetLinkPrototype(), nd) if err != nil { return cidlink.Link{}, NewErrWritingBlock(err) @@ -155,7 +155,7 @@ func (mc *MerkleClock) ProcessBlock( continue } - known, err := mc.dagstore.Has(ctx, linkCid) + known, err := mc.blockstore.Has(ctx, linkCid) if err != nil { return NewErrCouldNotFindBlock(linkCid, err) } diff --git a/internal/merkle/clock/clock_test.go b/internal/merkle/clock/clock_test.go index c9a51a7a1e..7effc02fef 100644 --- a/internal/merkle/clock/clock_test.go +++ b/internal/merkle/clock/clock_test.go @@ -36,7 +36,7 @@ func newTestMerkleClock() *MerkleClock { reg := crdt.NewLWWRegister(multistore.Rootstore(), core.CollectionSchemaVersionKey{}, core.DataStoreKey{}, "") return NewMerkleClock( multistore.Headstore(), - multistore.DAGstore(), + multistore.Blockstore(), core.HeadStoreKey{DocID: request.DocIDArgName, FieldId: "1"}, reg, ) @@ -46,7 +46,7 @@ func TestNewMerkleClock(t *testing.T) { s := newDS() multistore := datastore.MultiStoreFrom(s) reg := crdt.NewLWWRegister(multistore.Rootstore(), core.CollectionSchemaVersionKey{}, core.DataStoreKey{}, "") - clk := NewMerkleClock(multistore.Headstore(), multistore.DAGstore(), core.HeadStoreKey{}, reg) + clk := NewMerkleClock(multistore.Headstore(), multistore.Blockstore(), core.HeadStoreKey{}, reg) if clk.headstore != multistore.Headstore() { t.Error("MerkleClock store not correctly set") @@ -146,7 +146,7 @@ func TestMerkleClockAddDeltaWithHeads(t *testing.T) { } numBlocks := 0 - cids, err := clk.dagstore.AllKeysChan(ctx) + cids, err := clk.blockstore.AllKeysChan(ctx) if err != nil { t.Error("Failed to get blockstore content for merkle clock:", err) return diff --git a/internal/merkle/crdt/composite.go b/internal/merkle/crdt/composite.go index 33d6ab2d3c..26ab4134e5 100644 --- a/internal/merkle/crdt/composite.go +++ b/internal/merkle/crdt/composite.go @@ -44,7 +44,7 @@ func NewMerkleCompositeDAG( fieldName, ) - clock := clock.NewMerkleClock(store.Headstore(), store.DAGstore(), key.ToHeadStoreKey(), compositeDag) + clock := clock.NewMerkleClock(store.Headstore(), store.Blockstore(), key.ToHeadStoreKey(), compositeDag) base := &baseMerkleCRDT{clock: clock, crdt: compositeDag} return &MerkleCompositeDAG{ diff --git a/internal/merkle/crdt/counter.go b/internal/merkle/crdt/counter.go index c5d3a7e8dd..2553dcfd2f 100644 --- a/internal/merkle/crdt/counter.go +++ b/internal/merkle/crdt/counter.go @@ -39,7 +39,7 @@ func NewMerkleCounter( kind client.ScalarKind, ) *MerkleCounter { register := crdt.NewCounter(store.Datastore(), schemaVersionKey, key, fieldName, allowDecrement, kind) - clk := clock.NewMerkleClock(store.Headstore(), store.DAGstore(), key.ToHeadStoreKey(), register) + clk := clock.NewMerkleClock(store.Headstore(), store.Blockstore(), key.ToHeadStoreKey(), register) base := &baseMerkleCRDT{clock: clk, crdt: register} return &MerkleCounter{ baseMerkleCRDT: base, diff --git a/internal/merkle/crdt/lwwreg.go b/internal/merkle/crdt/lwwreg.go index 6755eac639..b8132ccad5 100644 --- a/internal/merkle/crdt/lwwreg.go +++ b/internal/merkle/crdt/lwwreg.go @@ -37,7 +37,7 @@ func NewMerkleLWWRegister( fieldName string, ) *MerkleLWWRegister { register := corecrdt.NewLWWRegister(store.Datastore(), schemaVersionKey, key, fieldName) - clk := clock.NewMerkleClock(store.Headstore(), store.DAGstore(), key.ToHeadStoreKey(), register) + clk := clock.NewMerkleClock(store.Headstore(), store.Blockstore(), key.ToHeadStoreKey(), register) base := &baseMerkleCRDT{clock: clk, crdt: register} return &MerkleLWWRegister{ baseMerkleCRDT: base, diff --git a/internal/merkle/crdt/merklecrdt.go b/internal/merkle/crdt/merklecrdt.go index abc0ffeb51..fc3019b05c 100644 --- a/internal/merkle/crdt/merklecrdt.go +++ b/internal/merkle/crdt/merklecrdt.go @@ -26,7 +26,7 @@ import ( type Stores interface { Datastore() datastore.DSReaderWriter - DAGstore() datastore.DAGStore + Blockstore() datastore.Blockstore Headstore() datastore.DSReaderWriter } diff --git a/internal/merkle/crdt/merklecrdt_test.go b/internal/merkle/crdt/merklecrdt_test.go index bd42223509..29482b28bf 100644 --- a/internal/merkle/crdt/merklecrdt_test.go +++ b/internal/merkle/crdt/merklecrdt_test.go @@ -32,7 +32,7 @@ func newTestBaseMerkleCRDT() (*baseMerkleCRDT, datastore.DSReaderWriter) { multistore := datastore.MultiStoreFrom(s) reg := crdt.NewLWWRegister(multistore.Datastore(), core.CollectionSchemaVersionKey{}, core.DataStoreKey{}, "") - clk := clock.NewMerkleClock(multistore.Headstore(), multistore.DAGstore(), core.HeadStoreKey{}, reg) + clk := clock.NewMerkleClock(multistore.Headstore(), multistore.Blockstore(), core.HeadStoreKey{}, reg) return &baseMerkleCRDT{clock: clk, crdt: reg}, multistore.Rootstore() } diff --git a/internal/planner/commit.go b/internal/planner/commit.go index 2f9de44bac..3a5bec39f9 100644 --- a/internal/planner/commit.go +++ b/internal/planner/commit.go @@ -184,7 +184,7 @@ func (n *dagScanNode) Next() (bool, error) { n.execInfo.iterations++ var currentCid *cid.Cid - store := n.planner.txn.DAGstore() + store := n.planner.txn.Blockstore() if len(n.queuedCids) > 0 { currentCid = n.queuedCids[0] diff --git a/net/peer.go b/net/peer.go index adb749de70..17ac7ad2e3 100644 --- a/net/peer.go +++ b/net/peer.go @@ -288,7 +288,7 @@ func (p *Peer) pushToReplicator( } // loop over heads, get block, make the required logs, and send for _, c := range cids { - blk, err := txn.DAGstore().Get(ctx, c) + blk, err := txn.Blockstore().Get(ctx, c) if err != nil { log.ErrorContextE(ctx, "Failed to get block", err, corelog.Any("CID", c), diff --git a/node/store.go b/node/store.go index 8354c0f7df..1a5b46f8e0 100644 --- a/node/store.go +++ b/node/store.go @@ -77,7 +77,7 @@ func WithEncryptionKey(encryptionKey []byte) StoreOpt { } // NewStore returns a new store with the given options. -func NewStore(ctx context.Context, opts ...StoreOpt) (datastore.RootStore, error) { +func NewStore(ctx context.Context, opts ...StoreOpt) (datastore.Rootstore, error) { options := DefaultStoreOptions() for _, opt := range opts { opt(options) diff --git a/tests/bench/query/planner/utils.go b/tests/bench/query/planner/utils.go index b91b0aa2a3..5a842222f5 100644 --- a/tests/bench/query/planner/utils.go +++ b/tests/bench/query/planner/utils.go @@ -136,7 +136,7 @@ func (*dummyTxn) Rootstore() datastore.DSReaderWriter { return nil } func (*dummyTxn) Datastore() datastore.DSReaderWriter { return nil } func (*dummyTxn) Headstore() datastore.DSReaderWriter { return nil } func (*dummyTxn) Peerstore() datastore.DSBatching { return nil } -func (*dummyTxn) DAGstore() datastore.DAGStore { return nil } +func (*dummyTxn) Blockstore() datastore.Blockstore { return nil } func (*dummyTxn) Systemstore() datastore.DSReaderWriter { return nil } func (*dummyTxn) Commit(ctx context.Context) error { return nil } func (*dummyTxn) Discard(ctx context.Context) {} diff --git a/tests/clients/cli/wrapper.go b/tests/clients/cli/wrapper.go index 18e306c0f4..464a75baef 100644 --- a/tests/clients/cli/wrapper.go +++ b/tests/clients/cli/wrapper.go @@ -503,11 +503,11 @@ func (w *Wrapper) NewConcurrentTxn(ctx context.Context, readOnly bool) (datastor return &Transaction{tx, w.cmd}, nil } -func (w *Wrapper) Root() datastore.RootStore { +func (w *Wrapper) Root() datastore.Rootstore { return w.node.Root() } -func (w *Wrapper) Blockstore() datastore.DAGStore { +func (w *Wrapper) Blockstore() datastore.Blockstore { return w.node.Blockstore() } diff --git a/tests/clients/cli/wrapper_tx.go b/tests/clients/cli/wrapper_tx.go index 5b5b2c3ea7..0330b8d47e 100644 --- a/tests/clients/cli/wrapper_tx.go +++ b/tests/clients/cli/wrapper_tx.go @@ -83,8 +83,8 @@ func (w *Transaction) Peerstore() datastore.DSBatching { return w.tx.Peerstore() } -func (w *Transaction) DAGstore() datastore.DAGStore { - return w.tx.DAGstore() +func (w *Transaction) Blockstore() datastore.Blockstore { + return w.tx.Blockstore() } func (w *Transaction) Systemstore() datastore.DSReaderWriter { diff --git a/tests/clients/http/wrapper.go b/tests/clients/http/wrapper.go index 89b5bce5e7..bb60f40c05 100644 --- a/tests/clients/http/wrapper.go +++ b/tests/clients/http/wrapper.go @@ -199,11 +199,11 @@ func (w *Wrapper) NewConcurrentTxn(ctx context.Context, readOnly bool) (datastor return &TxWrapper{server, client}, nil } -func (w *Wrapper) Root() datastore.RootStore { +func (w *Wrapper) Root() datastore.Rootstore { return w.node.Root() } -func (w *Wrapper) Blockstore() datastore.DAGStore { +func (w *Wrapper) Blockstore() datastore.Blockstore { return w.node.Blockstore() } diff --git a/tests/clients/http/wrapper_tx.go b/tests/clients/http/wrapper_tx.go index d53d967b3b..133d3bc1d3 100644 --- a/tests/clients/http/wrapper_tx.go +++ b/tests/clients/http/wrapper_tx.go @@ -77,8 +77,8 @@ func (w *TxWrapper) Peerstore() datastore.DSBatching { return w.server.Peerstore() } -func (w *TxWrapper) DAGstore() datastore.DAGStore { - return w.server.DAGstore() +func (w *TxWrapper) Blockstore() datastore.Blockstore { + return w.server.Blockstore() } func (w *TxWrapper) Systemstore() datastore.DSReaderWriter {