Skip to content

Commit

Permalink
bitmap add offset range struct in keyRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
VCgege committed Jun 24, 2024
1 parent 573271d commit a655c03
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 203 deletions.
17 changes: 9 additions & 8 deletions src/ctrip_swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ typedef struct range {
int reverse; /* LTRIM command specifies range to keep, so swap in the reverse range */
} range;

#define BITMAP_ARG_SINGLE 0
#define BITMAP_ARG_RANGE 1

typedef struct bitmapCmdArg {
int type; /* BITMAP_ARG_SINGLE, BITMAP_ARG_RANGE */
long long start;
Expand All @@ -183,18 +180,17 @@ typedef struct bitmapCmdArg {
#define KEYREQUEST_TYPE_RANGE 2
#define KEYREQUEST_TYPE_SCORE 3
#define KEYREQUEST_TYPE_SAMPLE 4
#define KEYREQUEST_TYPE_BTIMAP_ARG 5
#define KEYREQUEST_TYPE_BTIMAP_OFFSET 5
#define KEYREQUEST_TYPE_BTIMAP_RANGE 6

typedef struct argRewriteRequest {
int mstate_idx; /* >=0 if current command is a exec, means index in mstate; -1 means req not in multi/exec */
int arg_idx; /* index of argument to use for rewrite func */
int arg_type; /* only used for bitmap, BITMAP_ARG_SINGLE, BITMAP_ARG_RANGE */
} argRewriteRequest;

static inline void argRewriteRequestInit(argRewriteRequest *arg_req) {
arg_req->mstate_idx = -1;
arg_req->arg_idx = -1;
arg_req->arg_type = -1;
}

typedef struct keyRequest{
Expand Down Expand Up @@ -225,8 +221,13 @@ typedef struct keyRequest{
} sp; /* sample */
struct {
bool with_arg;
bitmapCmdArg *arg;
} bm; /* bitmap */
long long offset;
} bo; /* bitmap offset*/
struct {
bool with_arg;
long long start;
long long end;
} br; /* bitmap range*/
};
argRewriteRequest arg_rewrite[2];
swapCmdTrace *swap_cmd;
Expand Down
Loading

0 comments on commit a655c03

Please sign in to comment.