config => Config
This commit is contained in:
parent
3c78e418fb
commit
4edf7cfb05
@ -4,11 +4,11 @@ import "github.com/ethereum/eth-go/ethutil"
|
|||||||
|
|
||||||
var cnfCtr = ethutil.Hex2Bytes("661005d2720d855f1d9976f88bb10c1a3398c77f")
|
var cnfCtr = ethutil.Hex2Bytes("661005d2720d855f1d9976f88bb10c1a3398c77f")
|
||||||
|
|
||||||
type config struct {
|
type Config struct {
|
||||||
pipe *Pipe
|
pipe *Pipe
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *config) Get(name string) *Object {
|
func (self *Config) Get(name string) *Object {
|
||||||
configCtrl := self.pipe.World().safeGet(cnfCtr)
|
configCtrl := self.pipe.World().safeGet(cnfCtr)
|
||||||
var addr []byte
|
var addr []byte
|
||||||
|
|
||||||
@ -24,6 +24,6 @@ func (self *config) Get(name string) *Object {
|
|||||||
return &Object{self.pipe.World().safeGet(objectAddr.Bytes())}
|
return &Object{self.pipe.World().safeGet(objectAddr.Bytes())}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *config) Exist() bool {
|
func (self *Config) Exist() bool {
|
||||||
return self.pipe.World().Get(cnfCtr) != nil
|
return self.pipe.World().Get(cnfCtr) != nil
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,12 @@ import (
|
|||||||
|
|
||||||
type World struct {
|
type World struct {
|
||||||
pipe *Pipe
|
pipe *Pipe
|
||||||
cfg *config
|
cfg *Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWorld(pipe *Pipe) *World {
|
func NewWorld(pipe *Pipe) *World {
|
||||||
world := &World{pipe, nil}
|
world := &World{pipe, nil}
|
||||||
world.cfg = &config{pipe}
|
world.cfg = &Config{pipe}
|
||||||
|
|
||||||
return world
|
return world
|
||||||
}
|
}
|
||||||
@ -55,6 +55,6 @@ func (self *World) Peers() *list.List {
|
|||||||
return self.pipe.obj.Peers()
|
return self.pipe.obj.Peers()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *World) Config() *config {
|
func (self *World) Config() *Config {
|
||||||
return self.cfg
|
return self.cfg
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user