Skip to content

Latest commit

 

History

History
1934 lines (1512 loc) · 50.9 KB

proxy_api_guide-en.md

File metadata and controls

1934 lines (1512 loc) · 50.9 KB

Proxy API doc

getKV

int getKV(const GetKVReq &req, GetKVRsp &rsp)

Get value and other data by key

Parameters:

struct GetKVReq  
{  
  1 require string moduleName;  //module name  
  2 require string keyItem;
  3 require string idcSpecified = ""; //idc area  
};

struct GetKVRsp  
{  
  1 require string value;
  2 require byte ver;  //Data version number  
  3 require int expireTime = 0;  //expiration time 
}; 

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_DB_ERR access database error
ET_KEY_INVALID key is invalid
ET_INPUT_PARAM_ERROR parameter error, for example, the key is empty
ET_SYS_ERR system error
ET_NO_DATA data does not exist
ET_SUCC query data successfully

getKVBatch

int getKVBatch(const GetKVBatchReq &req, GetKVBatchRsp &rsp)

Bulk query

Parameters:

struct GetKVBatchReq
{
  1 require string moduleName; //module name
  2 require vector<string> keys; //set of keys
  3 require string idcSpecified = ""; //idc area 
};

struct GetKVBatchRsp
{
  1 require vector<SKeyValue> values;  //set of results
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_CACHE_ERR access cache error
ET_INPUT_PARAM_ERROR parameter error, for example, the number of keys exceeds the limit or a key is empty.
ET_SYS_ERR system error
ET_SUCC query data in batch successfully

checkKey

int checkKey(const CheckKeyReq &req, CheckKeyRsp &rsp)

Check status of multiple key-values

Parameters:

struct CheckKeyReq
{
  1 require string moduleName;  //module name
  2 require vector<string> keys;  //set of keys
  3 require string idcSpecified = "";  //idc area
};

struct CheckKeyRsp
{
  1 require map<string, SKeyStatus> keyStat; 
};

struct SKeyStatus
{
  1 require bool exist;  //whether the data exists
  2 require bool dirty;  //whether the data is dirty
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_CACHE_ERR access cache error
ET_INPUT_PARAM_ERROR parameter error, for example, the number of keys exceeds the limit or a key is empty.
ET_SYS_ERR system error
ET_SUCC query data in batch successfully

getAllKeys

int getAllKeys(const GetAllKeysReq &req, GetAllKeysRsp &rsp)

Get all keys in cache

Parameters:

struct GetAllKeysReq
{
  1 require string moduleName;  //module name
  2 require int index;  //traversing from the hash bucket specified by index, starting from 0
  3 require int count;  //the number of hash buckets to traverse
  4 require string idcSpecified = "";  //idc area
};

struct GetAllKeysRsp
{
  1 require vector<string> keys;  //set of keys
  2 require bool isEnd;   //since the number of buckets is uncertain, the isEnd parameter is used to indicate whether there is any hash bucket that has not been traversed
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_CACHE_ERR access cache error
ET_SYS_ERR system error
ET_SUCC query data successfully

setKV

int setKV(const SetKVReq &req)

insert data

Parameters:

struct SetKVReq
{
  1 require string moduleName;  //module name
  2 require SSetKeyValue data;
};

struct SSetKeyValue
{
  1 require string keyItem;  
  2 require string value;  
  3 require byte   version = 0;  //data version number
  4 require bool   dirty = true;  //whether to make it dirty data
  5 require int    expireTimeSecond = 0;  //expiration time, default is 0, indicating never expired
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_PARAM_TOO_LONG the length of key exceeds limit
ET_FORBID_OPT write disabled during migration
ET_DATA_VER_MISMATCH different version number
ET_MEM_FULL no free space in memory
ET_CACHE_ERR cache error
ET_INPUT_PARAM_ERROR parameter error, for example, the key is empty
ET_SYS_ERR system error
ET_SUCC insert successfully

insertKV

int insertKV(const SetKVReq &req)

Insert when data does not exist, otherwise it will fail

Parameters:

struct SetKVReq
{
  1 require string moduleName;  //module name
  2 require SSetKeyValue data;
};

struct SSetKeyValue
{
  1 require string keyItem;  
  2 require string value;  
  3 require byte   version = 0;  //data version number
  4 require bool   dirty = true;  //whether to make it dirty data
  5 require int    expireTimeSecond = 0;  //expiration time, default is 0, indicating never expired
};

Returns

Returns Description
ET_DATA_EXIST data already exists, nsertion is not allowed
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_PARAM_TOO_LONG the length of key exceeds limit
ET_FORBID_OPT write disabled during migration
ET_DATA_VER_MISMATCH different version number
ET_MEM_FULL no free space in memory
ET_CACHE_ERR cache error
ET_INPUT_PARAM_ERROR parameter error, for example, the key is empty
ET_SYS_ERR system error
ET_SUCC insert successfully

updateKV

int updateKV(const UpdateKVReq &req, UpdateKVRsp &rsp)

Update data

Parameters:

struct UpdateKVReq
{
  1 require string moduleName;  //module name
  2 require SSetKeyValue data;  //data used for updating
  3 require Op option;    //update action,including ADD/SUB/ADD_INSERT/SUB_INSERT
};

struct UpdateKVRsp
{
  1 require string retValue;
};

Returns

Returns Description
ET_NO_DATA data does not exist
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_PARAM_TOO_LONG the length of key exceeds limit
ET_FORBID_OPT write disabled during migration
ET_PARAM_OP_ERR option error
ET_DATA_VER_MISMATCH different version number
ET_MEM_FULL no free space in memory
ET_CACHE_ERR cache error
ET_INPUT_PARAM_ERROR parameter error, for example, the key is empty
ET_SYS_ERR system error
ET_SUCC update successfully

eraseKV

int eraseKV(const RemoveKVReq &req)

Delete data that is not dirty

Parameters:

struct RemoveKVReq
{
  1 require string moduleName;  //module name
  2 require KeyInfo keyInfo;
};

struct KeyInfo
{
  1 require string keyItem;  
  2 require byte version;  //Data version number
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT write disabled during migration
ET_ERASE_DIRTY_ERR can't be used to delete dirty data
ET_DATA_VER_MISMATCH different version number
ET_CACHE_ERR cache error
ET_INPUT_PARAM_ERROR parameter error, for example, the key is empty
ET_SYS_ERR system error
ET_SUCC delete successfully

delKV

int delKV(const RemoveKVReq &req)

Delete data, including dirty data

Parameters:

struct RemoveKVReq
{
  1 require string moduleName;  //module name
  2 require KeyInfo keyInfo;
};

struct KeyInfo
{
  1 require string keyItem;  
  2 require byte version;  //Data version number
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT write disabled during migration
ET_DB_ERR access database error
ET_DATA_VER_MISMATCH different version number
ET_CACHE_ERR cache error
ET_INPUT_PARAM_ERROR parameter error, for example, the key is empty
ET_SYS_ERR system error
ET_SUCC delete successfully

setKVBatch

int setKVBatch(const SetKVBatchReq &req, SetKVBatchRsp &rsp)

Insert data in batch

Parameters:

struct SetKVBatchReq
{
  1 require string moduleName;  //module name
  2 require vector<SSetKeyValue> data;  //batch data
};

struct SetKVBatchRsp
{
  1 require map<string, int> keyResult;   //results of insert key-values, WRITE_SUCC = 0/WRITE_ERROR = -1/WRITE_DATA_VER_MISMATCH = -2
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, the number of keys exceeds the limit or a key is empty.
ET_SYS_ERR system error
ET_PARTIAL_FAIL only part of data was inserted successfully
ET_SUCC all data is successfully inserted

eraseKVBatch

int eraseKVBatch(const RemoveKVBatchReq &req, RemoveKVBatchRsp &rsp)

Delete data in batches, this interface is not allowed to delete dirty data

Parameters:

struct RemoveKVBatchReq
{
  1 require string moduleName;  //module name
  2 require vector<KeyInfo> data;  
};

struct KeyInfo
{
  1 require string keyItem; 
  2 require byte version;  //Data version number
};

struct RemoveKVBatchRsp
{
  1 require map<string, int> keyResult;  //results of delete operation, WRITE_SUCC = 0/WRITE_ERROR = -1/WRITE_DATA_VER_MISMATCH = -2
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, the number of keys exceeds the limit or a key is empty.
ET_SYS_ERR system error
ET_PARTIAL_FAIL only part of the data was deleted successfully
ET_SUCC all data is successfully deleted

delKVBatch

int delKVBatch(const RemoveKVBatchReq &req, RemoveKVBatchRsp &rsp)

Delete data in batches, including dirty data

Parameters:

struct RemoveKVBatchReq
{
  1 require string moduleName;  //module name
  2 require vector<KeyInfo> data;  
};

struct KeyInfo
{
  1 require string keyItem;  
  2 require byte version;  //Data version number
};

struct RemoveKVBatchRsp
{
  1 require map<string, int> keyResult;  //results of insert key-values WRITE_SUCC = 0/WRITE_ERROR = -1/WRITE_DATA_VER_MISMATCH = -2
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, the number of keys exceeds the limit or a key is empty.
ET_SYS_ERR system error
ET_PARTIAL_FAIL only part of the data was deleted successfully
ET_SUCC all data is successfully deleted

getMKV

int getMKV(const GetMKVReq &req, GetMKVRsp &rsp)

Query data based on fields and conditions

Parameters:

struct GetMKVReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require vector<Condition> cond;  //conditions used to filter data when query
  5 require bool retEntryCnt = false;  //whether to return the number of records where the primary key is mainKey
  6 require string idcSpecified = "";  //idc area
};

struct GetMKVRsp
{
  1 require vector<map<string, string> > data;  //result set
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_PARAM_LIMIT_VALUE_ERR The value of field named limit in a condition is incorrect.
ET_PARAM_NOT_EXIST invalid field in conditions
ET_PARAM_REDUNDANT duplicate field or field is invalid
ET_SYS_ERR system error
other values (greater than or equal to 0) if the retEntryCnt attribute of the request structure is set to true, the return value indicates the total number of records under the primary key. Otherwise, only the operation is successful.

getMainKeyCount

int getMainKeyCount(const MainKeyReq &req)

Get the total number of data records under the given mainKey

Parameters:

struct MainKeyReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string idcSpecified = "";  //idc area
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
other values (greater than or equal to 0) the total number of data records under the given mainKey

getMKVBatch

int getMKVBatch(const MKVBatchReq &req, MKVBatchRsp &rsp)

Query in batch

Parameters:

struct MKVBatchReq
{
  1 require string moduleName; //module name
  2 require vector<string> mainKeys;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require vector<Condition> cond;  //conditions used to filter data when query
  5 require string idcSpecified = "";  //idc area
};

struct Condition
{
  1 require string fieldName;  
  2 require Op op;  //condition operators, support ==/!=/</>/<=/>=
  3 require string value;  
};

struct MKVBatchRsp
{
  1require vector<MainKeyValue> data;  //result set
};

struct MainKeyValue
{
  1 require string mainKey;  
  2 require vector<map<string, string> > value;  //records queried under the specified mainKey
  3 require int ret; //ret>=0, success; other values, failed
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID some mainKeys are invalid
ET_INPUT_PARAM_ERROR invalid mainKey or too many mainKeys
ET_PARAM_LIMIT_VALUE_ERR The value of field named limit in a condition is incorrect.
ET_PARAM_NOT_EXIST invalid field in conditions
ET_PARAM_REDUNDANT duplicate field or field is invalid
ET_SYS_ERR system error
ET_SUCC query data in batch successfully

getMKVBatchEx

int getMKVBatchEx(const MKVBatchExReq &req, MKVBatchExRsp &rsp)

Query in batch, each mainKey has its specific query conditions

Parameters:

struct MKVBatchExReq
{
  1 require string moduleName;  //module name
  2 require vector<MainKeyCondition> cond;
  3 require string idcSpecified = "";  //idc area
};

struct MainKeyCondition
{
  1 require string mainKey;  
  2 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  3 require vector<vector<Condition> > cond;
  4 require Condition limit;  //op = DCache::LIMIT, value = "startIndex:countLimit"
  5 require bool bGetMKCout = false;  //whether to return the number of records where the primary key is mainKey
};

struct MKVBatchExRsp
{
  1 require vector<MainKeyValue> data;  //result set
};

struct MainKeyValue
{
  1 require string mainKey;  
  2 require vector<map<string, string> > value;  //records queried under the specified mainKey
  3 require int ret; //ret>=0, success; other values, failed
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID invalid mainKey in some conditions
ET_INPUT_PARAM_ERROR empty mainKey in some conditions or too many mainKes
ET_PARAM_LIMIT_VALUE_ERR the value of field named limit in a condition is incorrect
ET_PARAM_NOT_EXIST invalid field in conditions
ET_PARAM_REDUNDANT duplicate field or field is invalid
ET_SYS_ERR system error
ET_SUCC query data in batch successfully

getMUKBatch

int getMUKBatch(const MUKBatchReq &req, MUKBatchRsp &rsp)

Query in batch

Parameters:

struct MUKBatchReq
{
  1 require string moduleName;  //module name
  2 require vector<Record> primaryKeys;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require string idcSpecified = "";  //idc area
};

struct MUKBatchRsp
{
  1 require vector<Record> data;
};

struct Record
{
  1 require string mainKey;  
  2 require map<string, string> mpRecord; // In the request structure, this field represents the query condition and must contain all secondary keys, in the response structure, this field represents result set 
  3 require int ret;  //in the request structure, ignore it; in the response structure, ret>=0, success, other values, fail
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID some mainKeys are invalid
ET_INPUT_PARAM_ERROR invalid mainKey or too many mainKeys
ET_PARAM_MISSING not all secondary keys are included in conditions
ET_SYS_ERR system error
ET_SUCC query data in batch successfully

insertMKV

int insertMKV(const InsertMKVReq &req)

insert data

Parameters:

struct InsertMKVReq
{
  1 require string moduleName;  //module name
  2 require InsertKeyValue data;
};

struct InsertKeyValue
{
  1 require string mainKey;  
  2 require map<string, UpdateValue> mpValue;  //Other fields except mainKey
  3 require byte ver = 0;  //data version number
  4 require bool dirty = true;  //whether to make it dirty data
  5 require bool replace = false;  //overwrite old record if the record already exists and replace is true
  6 require  int  expireTimeSecond = 0;  //expiration time 
};

Returns

Returns Description
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_MODULE_NAME_INVALID module error
ET_FORBID_OPT data is being migrated
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, mainKey is empty.
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_MISSING did not contain all secondary keys
ET_PARAM_OP_ERR op error, only support SET
ET_PARAM_NOT_EXIST field does not exist
ET_DATA_EXIST Data already exists
ET_DATA_VER_MISMATCH different version number
ET_MEM_FULL no free space in memory
ET_SYS_ERR system error
ET_SUCC insert successfully

updateMKV

int updateMKV(const UpdateMKVReq &req)

Update data

Parameters:

struct UpdateMKVReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require map<string, UpdateValue> value;  //Fields that need to be updated, exclude secondary key 
  4 require vector<Condition> cond;  
  5 require byte ver = 0;  //data version number
  6 require bool dirty = true;  //whether to make it dirty data
  7 require bool insert = false; //insert a record if the unique record to be modified does not exist and insert == true
  8 require int expireTimeSecond = 0;  //expiration time
};

Returns

Returns Description
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_MODULE_NAME_INVALID module error
ET_FORBID_OPT data is being migrated
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, mainKey is empty.
ET_PARAM_UPDATE_UKEY_ERR fields to be updated contain secondary key field
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_NOT_EXIST field does not exist
ET_PARAM_REDUNDANT there are multiple secondary key fields with the same name in the condition.
ET_PARAM_LIMIT_VALUE_ERR the value of field named limit in a condition is incorrect
ET_DATA_VER_MISMATCH different version number
ET_SYS_ERR system error
other values (greater than or equal to 0) update successful, also this value indicates the number of records affected by the update operation

updateMKVAtom

int updateMKVAtom(const UpdateMKVAtomReq &req)

Atomically update data

Parameters:

struct UpdateMKVAtomReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require map<string, UpdateValue> value;  //fields that need to be updated, do not include the secondary key field, op supports SET, ADD, SUB operations.
  4 require vector<Condition> cond;  
  5 require bool dirty = true;  //whether to make it dirty data
  6 require int  expireTimeSecond = 0;  //expiration time
};

Returns

Returns Description
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_MODULE_NAME_INVALID module error
ET_FORBID_OPT data is being migrated
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, mainKey is empty.
ET_PARAM_UPDATE_UKEY_ERR fields to be updated contain secondary key field
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_NOT_EXIST field does not exist
ET_PARAM_REDUNDANT there are multiple secondary key fields with the same name in the condition.
ET_PARAM_LIMIT_VALUE_ERR the value of field named limit in a condition is incorrect
ET_DATA_VER_MISMATCH different version number
ET_SYS_ERR system error
other values (greater than or equal to 0) update successful, also this value indicates the number of records affected by the update operation

eraseMKV

int eraseMKV(const MainKeyReq &req)

Delete data which is not dirty

Parameters:

struct MainKeyReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string idcSpecified = "";  //idc area
};

Returns

Returns Description
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_MODULE_NAME_INVALID module error
ET_FORBID_OPT data is being migrated
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, mainKey is empty.
ET_ERASE_DIRTY_ERR trying to delete dirty data
ET_SYS_ERR system error
ET_SUCC delete successfully

delMKV

int delMKV(const DelMKVReq &req)

Delete data, including dirty data

Parameters:

struct DelMKVReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require vector<Condition> cond;
};

struct Condition
{
  1 require string fieldName;  
  2 require Op op;  //condition operators, support ==/!=/</>/<=/>=
  3 require string value;  
};

Returns

Returns Description
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_MODULE_NAME_INVALID module error
ET_FORBID_OPT data is being migrated
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_INPUT_PARAM_ERROR parameter error, for example, mainKey is empty.
ET_PARAM_LIMIT_VALUE_ERR the value of field named limit in a condition is incorrect
ET_PARAM_NOT_EXIST field does not exist
ET_PARAM_REDUNDANT multiple fields with the same name
ET_SYS_ERR system error
ET_SUCC delete successfully

insertMKVBatch

int insertMKVBatch(const InsertMKVBatchReq &req, MKVBatchWriteRsp &rsp)

Bulk insert

Parameters:

struct InsertMKVBatchReq
{
  1 require string moduleName;  //module name
  2 require vector<InsertKeyValue> data;  
};

struct InsertKeyValue
{
  1 require string mainKey;  
  2 require map<string, UpdateValue> mpValue;  //values of fields exclude mainKey
  3 require byte ver = 0;  //data version number
  4 require bool dirty = true;  //whether to make it dirty data
  5 require bool replace = false; //overwrite old record if the record already exists and replace is true
  6 require int expireTimeSecond = 0;  //expiration time
};

struct MKVBatchWriteRsp
{
  1 require map<int, int> rspData;  //key:the index of the data field in the request structure,value:the reason for inserting failure, rspData is empty if all inserts succeed
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_INPUT_PARAM_ERROR invalid mainKey or too many mainKeys
ET_KEY_INVALID mainKey is invalid
ET_SYS_ERR system error
ET_SUCC operation of bulk insert completed

updateMKVBatch

int updateMKVBatch(const UpdateMKVBatchReq &req, MKVBatchWriteRsp &rsp)

Bulk update

Parameters:

struct UpdateMKVBatchReq
{
  1 require string moduleName;  //module name
  2 require vector<UpdateKeyValue> data;  
};

struct UpdateKeyValue
{
  1 require  string mainKey;  
  2 require  map<string, UpdateFieldInfo> mpValue;
  3 require  byte ver = 0;  //Data version number
  4 require  bool dirty = true;  //whether to make it dirty data
  5 require  bool insert = false; //insert a record if the unique record to be modified does not exist and insert == true
  6 require  int  expireTimeSecond = 0;  //expiration time
};

struct MKVBatchWriteRsp
{
  1 require map<int, int> rspData;  //key:the index of the data field in the request structure,value:the reason for inserting failure, rspData is empty if all inserts succeed
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_INPUT_PARAM_ERROR invalid mainKey or too many mainKeys
ET_KEY_INVALID mainKey is invalid
ET_SYS_ERR system error
ET_SUCC operation of bulk update completed

delMKVBatch

int delMKVBatch(const DelMKVBatchReq &req, MKVBatchWriteRsp &rsp)

bulk delete

Parameters:

struct DelMKVBatchReq
{
  1 require string moduleName;  //module name
  2 require vector<DelCondition> data;  
};

struct DelCondition
{
  1 require string mainKey;  
  2 require vector<Condition> cond;
  3 require byte ver = 0; //Data version number
};

struct MKVBatchWriteRsp
{
  1 require map<int, int> rspData;  //key: The index of the data in the request structure, value: the result of the deletion. The value greater than or equal to 0 indicates the number of records deleted, other values indicate why the deletion failed
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_INPUT_PARAM_ERROR invalid mainKey or too many mainKeys
ET_KEY_INVALID mainKey is invalid
ET_SYS_ERR system error
ET_SUCC operation of bulk delete completed

getList

int getList(const GetListReq &req, GetListRsp &rsp)

Query data based on specified mainKey and index

Parameters:

struct GetListReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require long index;
  5 require string idcSpecified = "";  //idc area
};

struct GetListRsp
{
  1 require Entry entry;  //result set
};

struct Entry
{
  1 require map<string, string> data;
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC query successfully

getRangeList

int getRangeList(const GetRangeListReq &req, BatchEntry &rsp)

Get a range of elements from a list

Parameters:

struct GetRangeListReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require long startIndex;  
  5 require long endIndex;
  6 require string idcSpecified = "";  //idc area
};

struct BatchEntry
{
1 require vector<map<string, string>> entries;  //result set
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC query successfully

pushList

int pushList(const PushListReq &req)

Add one or more data to the head or tail of the list

Parameters:

struct PushListReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require vector<InsertKeyValue> data;  
  4 require bool atHead = true;   //Insert data in the head of the list if it is true, otherwise insert data in the tail of the list
};

struct InsertKeyValue
{
  1 require string mainKey;  
  2 require map<string, UpdateValue> mpValue;
  3 require byte ver = 0;  //Data version number
  4 require bool dirty = true;  //whether to make it dirty data
  5 require bool replace = false; //overwrite old record if the record already exists and replace is true
  6 require int expireTimeSecond = 0;  
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_OP_ERR op error, only support SET
ET_PARAM_NOT_EXIST field does not exist
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC push successfully

popList

int popList(const PopListReq &req, PopListRsp &rsp)

Remove one element from the head or tail of the list

Parameters:

struct PopListReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require bool atHead = true;   //remove from the head if it true, otherwise remove from the tail
};

struct PopListRsp
{
  1 require Entry entry;  //data that was removed
};

struct Entry
{
  1 require map<string, string> data;
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC reomve successfully

replaceList

int replaceList(const ReplaceListReq &req)

Replace data based on specified mainKey and specified index

Parameters:

struct ReplaceListReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require map<string, UpdateValue> data;  //data used for updating
  4 require long index;  //specified index
  5 require int expireTime;  //expiration time
};

struct UpdateValue
{
  1 require Op op;  //update operator, only support SET
  2 require string value;  
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_OP_ERR op error, only support SET
ET_PARAM_NOT_EXIST field does not exist
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC replace successfully

trimList

int trimList(const TrimListReq &req)

Trim list

Parameters:

struct TrimListReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require long startIndex;  
  4 require long endIndex;  
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC success

remList

int remList(const RemListReq &req)

Remove one or more elements from the head or tail of the list

Parameters:

struct RemListReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require bool atHead = true;   //remove from the head if it is true, otherwise from the tail
  4 require long count;  //indicate how many records to be removed
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC delete successfully

getSet

int getSet(const GetSetReq &req, BatchEntry &rsp)

get all members from a set

Parameters:

struct GetSetReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require string idcSpecified = "";  //idc area
};

struct BatchEntry
{
  1 require vector<map<string, string>> entries;  //result set
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC query successfully

addSet

int addSet(const AddSetReq &req)

Add one member to a set

Parameters:

struct AddSetReq
{
  1 require string moduleName;  //module name
  2 require AddSetKeyValue value;  
};

struct AddSetKeyValue
{
  1 require string mainKey;  
  2 require map<string, UpdateValue> data;  
  3 require int expireTime;  //expiration time
  4 require bool dirty = true;  //whether to make it dirty data
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_OP_ERR op error, only support SET
ET_PARAM_NOT_EXIST field does not exist
ET_DATA_EXIST data already exists
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC add successfully

delSet

int delSet(const DelSetReq &req)

remove one member from a set

Parameters:

struct DelSetReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require vector<Condition> cond;  
};

struct Condition
{
  1 require string fieldName;  //all fields, excluding mainKey
  2 require Op op;  //only suuport EQ
  3 require string value;  
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_REDUNDANT multiple fields with the same name
ET_PARAM_MISSING some fields are missing
ET_DB_ERR access database error
ET_PARAM_OP_ERR only support EQ
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC remove successfully

getZSetScore

int getZSetScore(const GetZsetScoreReq &req, double &score)

Get the score associated with the given memeber in a sorted set

Parameters:

struct GetZsetScoreReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require vector<Condition> cond;  
  4 require string idcSpecified = "";  //idc area
};

struct Condition
{
  1 require string fieldName;  //all fields, excluding mainKey
  2 require Op op;  //only support EQ
  3 require string value;  
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_PARAM_REDUNDANT multiple fields with the same name
ET_PARAM_MISSING some fields are missing
ET_DB_ERR access database error
ET_PARAM_OP_ERR only support EQ
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_NO_DATA eligible member does not exist
ET_SUCC success

getZSetPos

int getZSetPos(const GetZsetPosReq &req, long &pos)

Get the index of the member of the specified condition in a sorted set

Parameters:

struct GetZsetPosReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require vector<Condition> cond; //specified conditions 
  4 require bool positiveOrder = true;  //positive sequence lookup if if is true, otherwise reverse sequence lookup
  5 require string idcSpecified = "";  //idc area
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_PARAM_REDUNDANT multiple fields with the same name
ET_PARAM_MISSING some fields are missing
ET_DB_ERR access database error
ET_PARAM_OP_ERR only support EQ
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_NO_DATA eligible member does not exist
ET_SUCC success

getZSetByPos

int getZSetByPos(const GetZsetByPosReq &req, BatchEntry &rsp)

Get a range of memebers in a sorted set by index

Parameters:

struct GetZsetByPosReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require long start;  
  5 require long end;  
  6 require bool positiveOrder = true; //results are sorted in ascending order by score if it is true, otherwise sorted in descending order of score
  7 require string idcSpecified = "";  //idc area
};

struct BatchEntry
{
  1 require vector<map<string, string>> entries;
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_DB_ERR access database error
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC success

getZSetByScore

int getZSetByScore(const GetZsetByScoreReq &req, BatchEntry &rsp)

Get a range of memebers in a sorted set by score

Parameters:

struct GetZsetByScoreReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require string field;  //the set of fields to be queried, multiple fields separated by ',' such as "a, b", "*" for all fields
  4 require double minScore;
  5 require double maxScore
  6 require string idcSpecified = "";  //idc area
};

struct BatchEntry
{
  1 require vector<map<string, string>> entries;
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_DB_ERR access database error
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC success

addZSet

int addZSet(const AddZSetReq &req)

Add one member to a sorted set, or update its score if it already exists

Parameters:

AddZSetReq
{
  1 require string moduleName;  //module name
  2 require AddSetKeyValue value;  
  3 require double score;
};

struct AddSetKeyValue
{
  1 require string mainKey;  
  2 require map<string, UpdateValue> data; 
  3 require int expireTime;  //expiration time 
  4 require bool dirty = true;  //whether to make it dirty data
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_OP_ERR op error, only support SET
ET_PARAM_NOT_EXIST field does not exist
ET_MEM_FULL no free space in memory
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC success

incScoreZSet

int incScoreZSet(const IncZSetScoreReq &req)

Modify the score of a member in a sorted set, if the member does not exist, it is added with scoreDiff as its score(as if its previous score was 0.0)

Parameters:

struct IncZSetScoreReq
{
  1 require string moduleName;  //module name
  2 require AddSetKeyValue value;  //
  3 require double scoreDiff;  //The increment of the score, which can be negative
};

struct AddSetKeyValue
{
  1 require string mainKey;  
  2 require map<string, UpdateValue> data;
  3 require int expireTime;  //expiration time 
  4 require bool dirty = true;  //whether to make it dirty data
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_OP_ERR op error, only support SET
ET_PARAM_NOT_EXIST field does not exist
ET_MEM_FULL no free space in memory
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC success

delZSet

int delZSet(const DelZSetReq &req)

Remove a member in a sorted set that meets the specified conditions

Parameters:

struct DelZSetReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require vector<Condition> cond;
};

struct Condition
{
  1 require string fieldName;  //all fields, excluding mainKey
  2 require Op op;  //only support EQ
  3 require string value;  
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_REDUNDANT multiple fields with the same name
ET_PARAM_MISSING some fields are missing
ET_DB_ERR access database error
ET_PARAM_OP_ERR only support EQ
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC delete successfully

delZSetByScore

int delZSetByScore(const DelZSetByScoreReq &req)

Remove members in a sorted set within the given scores

Parameters:

struct DelZSetByScoreReq
{
  1 require string moduleName;  //module name
  2 require string mainKey;  
  3 require double minScore;
  4 require double maxScore;
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_DB_ERR access database error
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC delete successfully

updateZSet

int updateZSet(const UpdateZSetReq &req)

Update a member in a sorted set that meets the specified conditions

Parameters:

struct UpdateZSetReq
{
  1 require string moduleName;  //module name
  2 require AddSetKeyValue value;  //data used for updating
  3 require vector<Condition> cond;
};

struct AddSetKeyValue
{
  1 require string mainKey;  
  2 require map<string, UpdateValue> data;  //data used for updating
  3 require int expireTime;  //expiration time 
  4 require bool dirty = true;  //whether to make it dirty data
};

struct Condition
{
  1 require string fieldName;  //all fields, excluding mainKey
  2 require Op op;  //only support EQ
  3 require string value;  
};

Returns

Returns Description
ET_MODULE_NAME_INVALID module error
ET_KEY_AREA_ERR The current Key should not be assigned to this node, need to update the routing table to re-access
ET_FORBID_OPT data is being migrated
ET_SERVER_TYPE_ERR service is not provided since it is a slave
ET_PARAM_DIGITAL_ERR field error, such as a field with a numeric type containing non-numeric characters
ET_PARAM_TOO_LONG the length of field exceeds limit
ET_PARAM_NOT_EXIST field does not exist
ET_PARAM_MISSING some fields are missing
ET_PARAM_REDUNDANT multiple fields with the same name
ET_PARAM_OP_ERR only support EQ
ET_DB_ERR access database error
ET_KEY_INVALID mainKey is invalid
ET_INPUT_PARAM_ERROR mainKey is empty
ET_SYS_ERR system error
ET_SUCC update successfully