ipld-eth-server/pkg/observers/blockchain_db_observer.go

19 lines
469 B
Go
Raw Normal View History

package observers
import (
2017-11-06 18:53:43 +00:00
"github.com/8thlight/vulcanizedb/pkg/core"
"github.com/8thlight/vulcanizedb/pkg/repositories"
)
type BlockchainDbObserver struct {
repository repositories.Repository
}
func NewBlockchainDbObserver(repository repositories.Repository) BlockchainDbObserver {
return BlockchainDbObserver{repository: repository}
}
func (observer BlockchainDbObserver) NotifyBlockAdded(block core.Block) {
observer.repository.CreateOrUpdateBlock(block)
}