Skip to content

Commit

Permalink
add redis queue & async message strategy (#615)
Browse files Browse the repository at this point in the history
* add redis queue & async message strategy

* fix bug

* fix ut

* add redis queue to provider factory

* use shared lock

* upsert plan state bug fix

* upsert with metadata

upsert/delete/get with metadata

* lock -global

* refine lock

* global init by keylock as point

* add shared

* add log

* save planstate

* add log

* store deepcopy

* planState store object not copy

* fix stepid

* update plan state before each step

* check store result

* upsert plan state log

* remove point

* remove no use code

* delete save summary

* add upsert log

* add try lock result log& check job id before execute step

* remove no use log

* collect crash log

* remove some log

* remove lock in check id

* refine log &remove conclude summary in vendor

* get operation with namespace &check job id before each step execute

* replace unmarshal json

* re add conclude summary

* extract async reconcile strategy to solution-manager

* remove no use function

* paging response change to  interface{}

* remove no use code

* remove no use code

* remove no use pkg

* fix message type

* combine planstate and summary

* fix type issue

* remove remove param in planstate

* remove no ouse code

* init queue in solution manager

* multi get

* fix test

* add queue provider in ut

* add queue in test fact

* fix message id bug

* save summary one by one

* reuse json unmarshal in get result

* fix queue bug

* use new unmarshal

* change planstate to message type

* fix type issue

* merge apply &get

* refine code

* refine code
  • Loading branch information
yanjiaxin534 authored Jan 27, 2025
1 parent 501dc4a commit db8532e
Show file tree
Hide file tree
Showing 15 changed files with 1,674 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ func NewDeploymentState(deployment model.DeploymentSpec) (model.DeploymentState,

return ret, nil
}
func MergeDeploymentStates(previous *model.DeploymentState, current model.DeploymentState) model.DeploymentState {
if previous == nil {
return current
}
func MergeDeploymentStates(previous model.DeploymentState, current model.DeploymentState) model.DeploymentState {
// merge components
for _, c := range previous.Components {
found := false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func TestMergeStateAddAComponent(t *testing.T) {
},
})
assert.Nil(t, err)
state := MergeDeploymentStates(&state1, state2)
state := MergeDeploymentStates(state1, state2)
assert.Equal(t, 3, len(state.Components))
assert.Equal(t, 1, len(state.Targets))
assert.Equal(t, "instance", state.TargetComponent["a::T1"])
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestMergeStateRemoveAComponent(t *testing.T) {
},
})
assert.Nil(t, err)
state := MergeDeploymentStates(&state1, state2)
state := MergeDeploymentStates(state1, state2)
assert.Equal(t, 3, len(state.Components))
assert.Equal(t, 1, len(state.Targets))
assert.Equal(t, "instance", state.TargetComponent["a::T1"])
Expand Down Expand Up @@ -367,7 +367,7 @@ func TestMergeStateProviderChange(t *testing.T) {
},
})
assert.Nil(t, err)
state := MergeDeploymentStates(&state1, state2)
state := MergeDeploymentStates(state1, state2)
assert.Equal(t, 3, len(state.Components))
assert.Equal(t, 2, len(state.Targets))
assert.Equal(t, "-instance", state.TargetComponent["a::T1"])
Expand Down Expand Up @@ -427,7 +427,7 @@ func TestMergeStateUnrelated(t *testing.T) {
},
})
assert.Nil(t, err)
state := MergeDeploymentStates(&state1, state2)
state := MergeDeploymentStates(state1, state2)
assert.Equal(t, 5, len(state.Components))
assert.Equal(t, 2, len(state.Targets))
assert.Equal(t, "-instance", state.TargetComponent["a::T1"])
Expand Down Expand Up @@ -493,7 +493,7 @@ func TestMergeStateAddProvider(t *testing.T) {
},
})
assert.Nil(t, err)
state := MergeDeploymentStates(&state1, state2)
state := MergeDeploymentStates(state1, state2)
assert.Equal(t, 3, len(state.Components))
assert.Equal(t, 2, len(state.Targets))
assert.Equal(t, 5, len(state.TargetComponent))
Expand Down
Loading

0 comments on commit db8532e

Please sign in to comment.