-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(peering): add ability to author custom peering agents (#3701)
* feat(peering): add ability to author custom peering agents This change adds an extension point (in the form of beans injected into the `PeeringAgent`) to allow peering of custom data in the `orca` [SQL] DB. Currently, the custom peering agents are called without much context as to what the main peering agent is doing (they are simply called at the end of every agent tick, after all main peering agent logic completes). This can be changed later if needed but for now I wanted to keep the two as independant and simple as possible. * fix(custom peering): add init method * fixup! fix(custom peering): add init method * fixup! fixup! fix(custom peering): add init method Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9aaa8e8
commit 859082e
Showing
7 changed files
with
183 additions
and
9 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
38 changes: 38 additions & 0 deletions
38
orca-peering/src/main/kotlin/com/netflix/spinnaker/orca/peering/CustomPeerer.kt
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,38 @@ | ||
/* | ||
* Copyright 2020 Netflix, Inc. | ||
* | ||
* 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 com.netflix.spinnaker.orca.peering | ||
|
||
/** | ||
* Interface that custom peerers should implement (and expose as a bean) | ||
*/ | ||
interface CustomPeerer { | ||
/** | ||
* Let the custom peerer initialize itself | ||
* | ||
* @param srcDb source/foreign (read-only) database, use srcDb.runQuery to get the jooq context to perform queries on | ||
* @param destDb destination/local database | ||
* @param peerId the id of the peer we are peering | ||
*/ | ||
fun init(srcDb: SqlRawAccess, destDb: SqlRawAccess, peerId: String) | ||
|
||
/** | ||
* doPeer function will be called AFTER all default peering actions are completed for this agent cycle | ||
* | ||
* @return true if peering completed successfully, false otherwise | ||
*/ | ||
fun doPeer(): Boolean | ||
} |
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
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