diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
| commit | dcacc00e3750300617ba6e16eb346713f91a783a (patch) | |
| tree | 38e2d4fb5ed9d119711d4295c6eda4b014af73fd /examples/redis-unstable/src/listpack.h | |
| parent | 58dac10aeb8f5a041c46bddbeaf4c7966a99b998 (diff) | |
| download | crep-dcacc00e3750300617ba6e16eb346713f91a783a.tar.gz | |
Remove testing data
Diffstat (limited to 'examples/redis-unstable/src/listpack.h')
| -rw-r--r-- | examples/redis-unstable/src/listpack.h | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/examples/redis-unstable/src/listpack.h b/examples/redis-unstable/src/listpack.h deleted file mode 100644 index 06723d2..0000000 --- a/examples/redis-unstable/src/listpack.h +++ /dev/null | |||
| @@ -1,97 +0,0 @@ | |||
| 1 | /* Listpack -- A lists of strings serialization format | ||
| 2 | * | ||
| 3 | * This file implements the specification you can find at: | ||
| 4 | * | ||
| 5 | * https://github.com/antirez/listpack | ||
| 6 | * | ||
| 7 | * Copyright (c) 2017-Present, Redis Ltd. | ||
| 8 | * All rights reserved. | ||
| 9 | * | ||
| 10 | * Licensed under your choice of (a) the Redis Source Available License 2.0 | ||
| 11 | * (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the | ||
| 12 | * GNU Affero General Public License v3 (AGPLv3). | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __LISTPACK_H | ||
| 16 | #define __LISTPACK_H | ||
| 17 | |||
| 18 | #include <stdlib.h> | ||
| 19 | #include <stdint.h> | ||
| 20 | |||
| 21 | #define LP_INTBUF_SIZE 21 /* 20 digits of -2^63 + 1 null term = 21. */ | ||
| 22 | |||
| 23 | /* lpInsert() where argument possible values: */ | ||
| 24 | #define LP_BEFORE 0 | ||
| 25 | #define LP_AFTER 1 | ||
| 26 | #define LP_REPLACE 2 | ||
| 27 | |||
| 28 | /* Each entry in the listpack is either a string or an integer. */ | ||
| 29 | typedef struct { | ||
| 30 | /* When string is used, it is provided with the length (slen). */ | ||
| 31 | unsigned char *sval; | ||
| 32 | uint32_t slen; | ||
| 33 | /* When integer is used, 'sval' is NULL, and lval holds the value. */ | ||
| 34 | long long lval; | ||
| 35 | } listpackEntry; | ||
| 36 | |||
| 37 | unsigned char *lpNew(size_t capacity); | ||
| 38 | void lpFree(unsigned char *lp); | ||
| 39 | unsigned char* lpShrinkToFit(unsigned char *lp); | ||
| 40 | unsigned char *lpInsertString(unsigned char *lp, unsigned char *s, uint32_t slen, | ||
| 41 | unsigned char *p, int where, unsigned char **newp); | ||
| 42 | unsigned char *lpInsertInteger(unsigned char *lp, long long lval, | ||
| 43 | unsigned char *p, int where, unsigned char **newp); | ||
| 44 | unsigned char *lpPrepend(unsigned char *lp, unsigned char *s, uint32_t slen); | ||
| 45 | unsigned char *lpPrependInteger(unsigned char *lp, long long lval); | ||
| 46 | unsigned char *lpAppend(unsigned char *lp, unsigned char *s, uint32_t slen); | ||
| 47 | unsigned char *lpAppendInteger(unsigned char *lp, long long lval); | ||
| 48 | unsigned char *lpReplace(unsigned char *lp, unsigned char **p, unsigned char *s, uint32_t slen); | ||
| 49 | unsigned char *lpReplaceInteger(unsigned char *lp, unsigned char **p, long long lval); | ||
| 50 | unsigned char *lpDelete(unsigned char *lp, unsigned char *p, unsigned char **newp); | ||
| 51 | unsigned char *lpDeleteRangeWithEntry(unsigned char *lp, unsigned char **p, unsigned long num); | ||
| 52 | unsigned char *lpDeleteRange(unsigned char *lp, long index, unsigned long num); | ||
| 53 | unsigned char *lpBatchAppend(unsigned char *lp, listpackEntry *entries, unsigned long len); | ||
| 54 | unsigned char *lpBatchInsert(unsigned char *lp, unsigned char *p, int where, | ||
| 55 | listpackEntry *entries, unsigned int len, unsigned char **newp); | ||
| 56 | unsigned char *lpBatchDelete(unsigned char *lp, unsigned char **ps, unsigned long count); | ||
| 57 | unsigned char *lpMerge(unsigned char **first, unsigned char **second); | ||
| 58 | unsigned char *lpDup(unsigned char *lp); | ||
| 59 | unsigned long lpLength(unsigned char *lp); | ||
| 60 | unsigned char *lpGet(unsigned char *p, int64_t *count, unsigned char *intbuf); | ||
| 61 | unsigned char *lpGetValue(unsigned char *p, unsigned int *slen, long long *lval); | ||
| 62 | int lpGetIntegerValue(unsigned char *p, long long *lval); | ||
| 63 | unsigned char *lpFind(unsigned char *lp, unsigned char *p, unsigned char *s, uint32_t slen, unsigned int skip); | ||
| 64 | typedef int (*lpCmp)(const unsigned char *lp, unsigned char *p, void *user, unsigned char *s, long long slen); | ||
| 65 | unsigned char *lpFindCb(unsigned char *lp, unsigned char *p, void *user, lpCmp cmp, unsigned int skip); | ||
| 66 | unsigned char *lpFirst(unsigned char *lp); | ||
| 67 | unsigned char *lpLast(unsigned char *lp); | ||
| 68 | unsigned char *lpNext(unsigned char *lp, unsigned char *p); | ||
| 69 | unsigned char *lpNextWithBytes(unsigned char *lp, unsigned char *p, const size_t lpbytes); | ||
| 70 | unsigned char *lpPrev(unsigned char *lp, unsigned char *p); | ||
| 71 | size_t lpBytes(unsigned char *lp); | ||
| 72 | size_t lpEntrySizeInteger(long long lval); | ||
| 73 | size_t lpEstimateBytesRepeatedInteger(long long lval, unsigned long rep); | ||
| 74 | unsigned char *lpSeek(unsigned char *lp, long index); | ||
| 75 | typedef int (*listpackValidateEntryCB)(unsigned char *p, unsigned int head_count, void *userdata); | ||
| 76 | int lpValidateIntegrity(unsigned char *lp, size_t size, int deep, | ||
| 77 | listpackValidateEntryCB entry_cb, void *cb_userdata); | ||
| 78 | unsigned char *lpValidateFirst(unsigned char *lp); | ||
| 79 | int lpValidateNext(unsigned char *lp, unsigned char **pp, size_t lpbytes); | ||
| 80 | unsigned int lpCompare(unsigned char *p, unsigned char *s, uint32_t slen, long long *cached_longval, int *cached_valid); | ||
| 81 | void lpRandomPair(unsigned char *lp, unsigned long total_count, | ||
| 82 | listpackEntry *key, listpackEntry *val, int tuple_len); | ||
| 83 | void lpRandomPairs(unsigned char *lp, unsigned int count, | ||
| 84 | listpackEntry *keys, listpackEntry *vals, int tuple_len); | ||
| 85 | unsigned int lpRandomPairsUnique(unsigned char *lp, unsigned int count, | ||
| 86 | listpackEntry *keys, listpackEntry *vals, int tuple_len); | ||
| 87 | void lpRandomEntries(unsigned char *lp, unsigned int count, listpackEntry *entries); | ||
| 88 | unsigned char *lpNextRandom(unsigned char *lp, unsigned char *p, unsigned int *index, | ||
| 89 | unsigned int remaining, int tuple_len); | ||
| 90 | int lpSafeToAdd(unsigned char* lp, size_t add); | ||
| 91 | void lpRepr(unsigned char *lp); | ||
| 92 | |||
| 93 | #ifdef REDIS_TEST | ||
| 94 | int listpackTest(int argc, char *argv[], int flags); | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #endif | ||
