more data
This commit is contained in:
@@ -65,7 +65,7 @@ func (p *GrainLocalPool) GetGrains() map[CartId]*CartGrain {
|
||||
return p.grains
|
||||
}
|
||||
|
||||
func (p *GrainLocalPool) Process(id CartId, messages ...Message) (interface{}, error) {
|
||||
func (p *GrainLocalPool) GetGrain(id CartId) (*CartGrain, error) {
|
||||
var err error
|
||||
grain, ok := p.grains[id]
|
||||
if !ok {
|
||||
@@ -81,6 +81,11 @@ func (p *GrainLocalPool) Process(id CartId, messages ...Message) (interface{}, e
|
||||
|
||||
p.grains[id] = grain
|
||||
}
|
||||
return grain, err
|
||||
}
|
||||
|
||||
func (p *GrainLocalPool) Process(id CartId, messages ...Message) (interface{}, error) {
|
||||
grain, err := p.GetGrain(id)
|
||||
if err == nil && grain != nil {
|
||||
for _, message := range messages {
|
||||
_, err = grain.HandleMessage(&message, false)
|
||||
@@ -90,9 +95,5 @@ func (p *GrainLocalPool) Process(id CartId, messages ...Message) (interface{}, e
|
||||
}
|
||||
|
||||
func (p *GrainLocalPool) Get(id CartId) (Grain, error) {
|
||||
grain, ok := p.grains[id]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("grain not found")
|
||||
}
|
||||
return grain, nil
|
||||
return p.GetGrain(id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user