-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CONTROLLER/RECORDER] refactors listener module
- Loading branch information
1 parent
c659f9c
commit 71c7018
Showing
94 changed files
with
1,713 additions
and
1,231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2023 Yunshan Networks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package listener | ||
|
||
import ( | ||
cloudmodel "github.com/deepflowio/deepflow/server/controller/cloud/model" | ||
"github.com/deepflowio/deepflow/server/controller/db/mysql" | ||
"github.com/deepflowio/deepflow/server/controller/recorder/cache" | ||
) | ||
|
||
type AZ struct { | ||
cache *cache.Cache | ||
} | ||
|
||
func NewAZ(c *cache.Cache) *AZ { | ||
listener := &AZ{ | ||
cache: c, | ||
} | ||
return listener | ||
} | ||
|
||
func (a *AZ) OnUpdaterAdded(addedDBItems []*mysql.AZ) { | ||
a.cache.AddAZs(addedDBItems) | ||
} | ||
|
||
func (a *AZ) OnUpdaterUpdated(cloudItem *cloudmodel.AZ, diffBase *cache.AZ) { | ||
diffBase.Update(cloudItem) | ||
} | ||
|
||
func (a *AZ) OnUpdaterDeleted(lcuuids []string) { | ||
a.cache.DeleteAZs(lcuuids) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2023 Yunshan Networks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package listener | ||
|
||
import ( | ||
cloudmodel "github.com/deepflowio/deepflow/server/controller/cloud/model" | ||
"github.com/deepflowio/deepflow/server/controller/db/mysql" | ||
"github.com/deepflowio/deepflow/server/controller/recorder/cache" | ||
) | ||
|
||
type CEN struct { | ||
cache *cache.Cache | ||
} | ||
|
||
func NewCEN(c *cache.Cache) *CEN { | ||
listener := &CEN{ | ||
cache: c, | ||
} | ||
return listener | ||
} | ||
|
||
func (c *CEN) OnUpdaterAdded(addedDBItems []*mysql.CEN) { | ||
c.cache.AddCENs(addedDBItems) | ||
} | ||
|
||
func (c *CEN) OnUpdaterUpdated(cloudItem *cloudmodel.CEN, diffBase *cache.CEN) { | ||
diffBase.Update(cloudItem) | ||
} | ||
|
||
func (c *CEN) OnUpdaterDeleted(lcuuids []string) { | ||
c.cache.DeleteCENs(lcuuids) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2023 Yunshan Networks | ||
* | ||
* LiFloatingIPsed under the Apache LiFloatingIPse, Version 2.0 (the "LiFloatingIPse"); | ||
* you may not use this file except in compliance with the LiFloatingIPse. | ||
* You may obtain a copy of the LiFloatingIPse at | ||
* | ||
* http://www.apache.org/liFloatingIPses/LIFloatingIPSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the LiFloatingIPse is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the LiFloatingIPse for the specific language governing permissions and | ||
* limitations under the LiFloatingIPse. | ||
*/ | ||
|
||
package listener | ||
|
||
import ( | ||
cloudmodel "github.com/deepflowio/deepflow/server/controller/cloud/model" | ||
"github.com/deepflowio/deepflow/server/controller/db/mysql" | ||
"github.com/deepflowio/deepflow/server/controller/recorder/cache" | ||
) | ||
|
||
type FloatingIP struct { | ||
cache *cache.Cache | ||
} | ||
|
||
func NewFloatingIP(c *cache.Cache) *FloatingIP { | ||
listener := &FloatingIP{ | ||
cache: c, | ||
} | ||
return listener | ||
} | ||
|
||
func (f *FloatingIP) OnUpdaterAdded(addedDBItems []*mysql.FloatingIP) { | ||
f.cache.AddFloatingIPs(addedDBItems) | ||
} | ||
|
||
func (f *FloatingIP) OnUpdaterUpdated(cloudItem *cloudmodel.FloatingIP, diffBase *cache.FloatingIP) { | ||
diffBase.Update(cloudItem) | ||
} | ||
|
||
func (f *FloatingIP) OnUpdaterDeleted(lcuuids []string) { | ||
f.cache.DeleteFloatingIPs(lcuuids) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2023 Yunshan Networks | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package listener | ||
|
||
import ( | ||
cloudmodel "github.com/deepflowio/deepflow/server/controller/cloud/model" | ||
"github.com/deepflowio/deepflow/server/controller/db/mysql" | ||
"github.com/deepflowio/deepflow/server/controller/recorder/cache" | ||
) | ||
|
||
type LBListener struct { | ||
cache *cache.Cache | ||
} | ||
|
||
func NewLBListener(c *cache.Cache) *LBListener { | ||
listener := &LBListener{ | ||
cache: c, | ||
} | ||
return listener | ||
} | ||
|
||
func (l *LBListener) OnUpdaterAdded(addedDBItems []*mysql.LBListener) { | ||
l.cache.AddLBListeners(addedDBItems) | ||
} | ||
|
||
func (l *LBListener) OnUpdaterUpdated(cloudItem *cloudmodel.LBListener, diffBase *cache.LBListener) { | ||
diffBase.Update(cloudItem) | ||
} | ||
|
||
func (l *LBListener) OnUpdaterDeleted(lcuuids []string) { | ||
l.cache.DeleteLBListeners(lcuuids) | ||
} |
Oops, something went wrong.