2020-01-17 23:16:01 +00:00
|
|
|
// VulcanizeDB
|
|
|
|
// Copyright © 2019 Vulcanize
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
package mocks
|
|
|
|
|
|
|
|
import (
|
2020-02-10 15:00:55 +00:00
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/postgres"
|
2020-01-17 23:16:01 +00:00
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/super_node/shared"
|
|
|
|
)
|
|
|
|
|
2020-02-20 22:12:52 +00:00
|
|
|
// CIDRetriever is a mock CID retriever for use in tests
|
|
|
|
type CIDRetriever struct {
|
2020-01-17 23:16:01 +00:00
|
|
|
GapsToRetrieve []shared.Gap
|
|
|
|
GapsToRetrieveErr error
|
|
|
|
CalledTimes int
|
|
|
|
FirstBlockNumberToReturn int64
|
|
|
|
RetrieveFirstBlockNumberErr error
|
|
|
|
}
|
|
|
|
|
|
|
|
// RetrieveCIDs mock method
|
2020-02-23 23:14:29 +00:00
|
|
|
func (*CIDRetriever) Retrieve(filter shared.SubscriptionSettings, blockNumber int64) ([]shared.CIDsForFetching, bool, error) {
|
2020-01-17 23:16:01 +00:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
|
|
|
// RetrieveLastBlockNumber mock method
|
2020-02-20 22:12:52 +00:00
|
|
|
func (*CIDRetriever) RetrieveLastBlockNumber() (int64, error) {
|
2020-01-17 23:16:01 +00:00
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
|
|
|
// RetrieveFirstBlockNumber mock method
|
2020-02-20 22:12:52 +00:00
|
|
|
func (mcr *CIDRetriever) RetrieveFirstBlockNumber() (int64, error) {
|
2020-01-17 23:16:01 +00:00
|
|
|
return mcr.FirstBlockNumberToReturn, mcr.RetrieveFirstBlockNumberErr
|
|
|
|
}
|
|
|
|
|
|
|
|
// RetrieveGapsInData mock method
|
2020-02-20 22:12:52 +00:00
|
|
|
func (mcr *CIDRetriever) RetrieveGapsInData() ([]shared.Gap, error) {
|
2020-01-17 23:16:01 +00:00
|
|
|
mcr.CalledTimes++
|
|
|
|
return mcr.GapsToRetrieve, mcr.GapsToRetrieveErr
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetGapsToRetrieve mock method
|
2020-02-20 22:12:52 +00:00
|
|
|
func (mcr *CIDRetriever) SetGapsToRetrieve(gaps []shared.Gap) {
|
2020-01-17 23:16:01 +00:00
|
|
|
if mcr.GapsToRetrieve == nil {
|
|
|
|
mcr.GapsToRetrieve = make([]shared.Gap, 0)
|
|
|
|
}
|
|
|
|
mcr.GapsToRetrieve = append(mcr.GapsToRetrieve, gaps...)
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:12:52 +00:00
|
|
|
func (mcr *CIDRetriever) Database() *postgres.DB {
|
2020-01-17 23:16:01 +00:00
|
|
|
panic("implement me")
|
|
|
|
}
|