Skip to content

Commit 5c4d9d9

Browse files
authored
Add interface to enable Redis pipeline and flush Producer(State)Table (sonic-net#139)
* Add option: redis pipeline * (comment)
1 parent 06d7b11 commit 5c4d9d9

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

lib/inc/sairedis.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ typedef enum _sai_redis_switch_attr_t
5050
*/
5151
SAI_REDIS_SWITCH_ATTR_USE_TEMP_VIEW,
5252

53+
/**
54+
* @brief Enable redis pipeline
55+
*
56+
* @type bool
57+
* @flags CREATE_AND_SET
58+
* @default false
59+
*/
60+
SAI_REDIS_SWITCH_ATTR_USE_PIPELINE,
61+
62+
/**
63+
* @brief Will flush redis pipeline
64+
*
65+
* @type bool
66+
* @flags CREATE_AND_SET
67+
* @default false
68+
*/
69+
SAI_REDIS_SWITCH_ATTR_FLUSH,
70+
5371
} sai_redis_switch_attr_t;
5472

5573
#endif // __SAIREDIS__

lib/src/sai_redis_switch.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,14 @@ sai_status_t redis_set_switch_attribute(
380380
g_useTempView = attr->value.booldata;
381381
return SAI_STATUS_SUCCESS;
382382

383+
case SAI_REDIS_SWITCH_ATTR_USE_PIPELINE:
384+
g_asicState->setBuffered(attr->value.booldata);
385+
return SAI_STATUS_SUCCESS;
386+
387+
case SAI_REDIS_SWITCH_ATTR_FLUSH:
388+
g_asicState->flush();
389+
return SAI_STATUS_SUCCESS;
390+
383391
default:
384392
break;
385393
}

0 commit comments

Comments
 (0)