The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/internal/registry/registry.go

36 lines
625 B

package registry
import (
"sync"
"github.com/harmony-one/harmony/core"
)
// Registry consolidates services at one place.
type Registry struct {
mu sync.Mutex
blockchain core.BlockChain
}
// New creates a new registry.
func New() *Registry {
return &Registry{}
}
// SetBlockchain sets the blockchain to registry.
func (r *Registry) SetBlockchain(bc core.BlockChain) *Registry {
r.mu.Lock()
defer r.mu.Unlock()
r.blockchain = bc
return r
}
// GetBlockchain gets the blockchain from registry.
func (r *Registry) GetBlockchain() core.BlockChain {
r.mu.Lock()
defer r.mu.Unlock()
return r.blockchain
}