Skip to content

Commit

Permalink
Add an optional parameter context
Browse files Browse the repository at this point in the history
  • Loading branch information
shi-su committed Feb 24, 2021
1 parent 43ff2d5 commit 0ec052a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions orchagent/orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,16 +686,16 @@ Executor *Orch::getExecutor(string executorName)
return NULL;
}

bool Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t status)
bool Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t status, void *context)
{
/*
* This function aims to provide coarse handling of failures in sairedis create
* operation (i.e., notify users by throwing excepions when failures happen).
* Return value: true - Handled the status successfully. No need to retry this SAI operation.
* false - Cannot handle the status. Need to retry the SAI operation.
* TODO: 1. Add general handling logic for specific statuses (e.g., SAI_STATUS_ITEM_ALREADY_EXISTS)
* 2. Develop fine-grain failure handling mechanisms specific and replace
* this coarse handling in each orch.
* 2. Develop fine-grain failure handling mechanisms and replace this coarse handling
* in each orch.
* 3. Take the type of sai api into consideration.
*/
switch (status)
Expand All @@ -711,16 +711,16 @@ bool Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t status)
return false;
}

bool Orch::handleSaiSetStatus(sai_api_t api, sai_status_t status)
bool Orch::handleSaiSetStatus(sai_api_t api, sai_status_t status, void *context)
{
/*
* This function aims to provide coarse handling of failures in sairedis set
* operation (i.e., notify users by throwing excepions when failures happen).
* Return value: true - Handled the status successfully. No need to retry this SAI operation.
* false - Cannot handle the status. Need to retry the SAI operation.
* TODO: 1. Add general handling logic for specific statuses
* 2. Develop fine-grain failure handling mechanisms specific and replace
* this coarse handling in each orch.
* 2. Develop fine-grain failure handling mechanisms and replace this coarse handling
* in each orch.
* 3. Take the type of sai api into consideration.
*/
switch (status)
Expand All @@ -736,7 +736,7 @@ bool Orch::handleSaiSetStatus(sai_api_t api, sai_status_t status)
return false;
}

bool Orch::handleSaiRemoveStatus(sai_api_t api, sai_status_t status)
bool Orch::handleSaiRemoveStatus(sai_api_t api, sai_status_t status, void *context)
{
/*
* This function aims to provide coarse handling of failures in sairedis remove
Expand All @@ -745,8 +745,8 @@ bool Orch::handleSaiRemoveStatus(sai_api_t api, sai_status_t status)
* false - Cannot handle the status. Need to retry the SAI operation.
* TODO: 1. Add general handling logic for specific statuses (e.g., SAI_STATUS_OBJECT_IN_USE,
* SAI_STATUS_ITEM_NOT_FOUND)
* 2. Develop fine-grain failure handling mechanisms specific and replace
* this coarse handling in each orch.
* 2. Develop fine-grain failure handling mechanisms and replace this coarse handling
* in each orch.
* 3. Take the type of sai api into consideration.
*/
switch (status)
Expand Down
6 changes: 3 additions & 3 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ class Orch
Executor *getExecutor(std::string executorName);

/* Handling SAI status*/
virtual bool handleSaiCreateStatus(sai_api_t api, sai_status_t status);
virtual bool handleSaiSetStatus(sai_api_t api, sai_status_t status);
virtual bool handleSaiRemoveStatus(sai_api_t api, sai_status_t status);
virtual bool handleSaiCreateStatus(sai_api_t api, sai_status_t status, void *context = nullptr);
virtual bool handleSaiSetStatus(sai_api_t api, sai_status_t status, void *context = nullptr);
virtual bool handleSaiRemoveStatus(sai_api_t api, sai_status_t status, void *context = nullptr);
private:
void removeMeFromObjsReferencedByMe(type_map &type_maps, const std::string &table, const std::string &obj_name, const std::string &field, const std::string &old_referenced_obj_name);
void addConsumer(swss::DBConnector *db, std::string tableName, int pri = default_orch_pri);
Expand Down

0 comments on commit 0ec052a

Please sign in to comment.