even more refactoring
This commit is contained in:
@@ -426,20 +426,13 @@ func (p *SyncedPool) getGrain(id CartId) (Grain, error) {
|
||||
return grain, nil
|
||||
}
|
||||
|
||||
// Process applies mutation(s) to a grain (local or remote).
|
||||
func (p *SyncedPool) Process(id CartId, mutations ...interface{}) (*CartGrain, error) {
|
||||
// Apply applies a single mutation to a grain (local or remote).
|
||||
func (p *SyncedPool) Apply(id CartId, mutation interface{}) (*CartGrain, error) {
|
||||
grain, err := p.getGrain(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var res *CartGrain
|
||||
for _, m := range mutations {
|
||||
res, err = grain.Apply(m, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return res, nil
|
||||
return grain.Apply(mutation, false)
|
||||
}
|
||||
|
||||
// Get returns current state of a grain (local or remote).
|
||||
|
||||
Reference in New Issue
Block a user