MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zuiLength

Function zuiLength

app/redis-6.2.6/src/t_zset.c:2135–2160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2133}
2134
2135unsigned long zuiLength(zsetopsrc *op) {
2136 if (op->subject == NULL)
2137 return 0;
2138
2139 if (op->type == OBJ_SET) {
2140 if (op->encoding == OBJ_ENCODING_INTSET) {
2141 return intsetLen(op->subject->ptr);
2142 } else if (op->encoding == OBJ_ENCODING_HT) {
2143 dict *ht = op->subject->ptr;
2144 return dictSize(ht);
2145 } else {
2146 serverPanic("Unknown set encoding");
2147 }
2148 } else if (op->type == OBJ_ZSET) {
2149 if (op->encoding == OBJ_ENCODING_ZIPLIST) {
2150 return zzlLength(op->subject->ptr);
2151 } else if (op->encoding == OBJ_ENCODING_SKIPLIST) {
2152 zset *zs = op->subject->ptr;
2153 return zs->zsl->length;
2154 } else {
2155 serverPanic("Unknown sorted set encoding");
2156 }
2157 } else {
2158 serverPanic("Unsupported type");
2159 }
2160}
2161
2162/* Check if the current value is valid. If so, store it in the passed structure
2163 * and move to the next element. If not valid, this means we have reached the

Callers 5

zuiCompareByCardinalityFunction · 0.85
zdiffAlgorithm2Function · 0.85
zsetChooseDiffAlgorithmFunction · 0.85
zdiffFunction · 0.85

Calls 2

intsetLenFunction · 0.85
zzlLengthFunction · 0.85

Tested by

no test coverage detected