2017-11-02 19:37:07 +00:00
|
|
|
package observers
|
2017-10-25 15:57:59 +00:00
|
|
|
|
|
|
|
import (
|
2017-11-02 19:37:07 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/core"
|
2017-11-03 13:01:35 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/repositories"
|
2017-10-25 15:57:59 +00:00
|
|
|
)
|
|
|
|
|
2017-11-06 16:52:07 +00:00
|
|
|
type BlockchainDbObserver struct {
|
|
|
|
repository repositories.Repository
|
2017-10-25 15:57:59 +00:00
|
|
|
}
|
|
|
|
|
2017-11-06 16:52:07 +00:00
|
|
|
func NewBlockchainDbObserver(repository repositories.Repository) BlockchainDbObserver {
|
|
|
|
return BlockchainDbObserver{repository: repository}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (observer BlockchainDbObserver) NotifyBlockAdded(block core.Block) {
|
|
|
|
observer.repository.CreateBlock(block)
|
2017-10-25 15:57:59 +00:00
|
|
|
}
|