even more refactoring
Some checks failed
Build and Publish / BuildAndDeploy (push) Successful in 3m7s
Build and Publish / BuildAndDeployAmd64 (push) Has been cancelled

This commit is contained in:
matst80
2025-10-10 11:46:19 +00:00
parent 12d87036f6
commit 716f1121aa
32 changed files with 3857 additions and 953 deletions

View File

@@ -26,7 +26,7 @@ var (
)
type GrainPool interface {
Process(id CartId, mutations ...interface{}) (*CartGrain, error)
Apply(id CartId, mutation interface{}) (*CartGrain, error)
Get(id CartId) (*CartGrain, error)
}
@@ -142,18 +142,12 @@ func (p *GrainLocalPool) GetGrain(id CartId) (*CartGrain, error) {
return grain, err
}
func (p *GrainLocalPool) Process(id CartId, mutations ...interface{}) (*CartGrain, error) {
func (p *GrainLocalPool) Apply(id CartId, mutation interface{}) (*CartGrain, error) {
grain, err := p.GetGrain(id)
var result *CartGrain
if err == nil && grain != nil {
for _, m := range mutations {
result, err = grain.Apply(m, false)
if err != nil {
break
}
}
if err != nil || grain == nil {
return nil, err
}
return result, err
return grain.Apply(mutation, false)
}
func (p *GrainLocalPool) Get(id CartId) (*CartGrain, error) {