MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / cmdXHSCAN

Method cmdXHSCAN

scan.go:133–168  ·  view source on GitHub ↗

XHSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]

(_ uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

131 return
132 }
133 if count > maxScanCount {
134 count = maxScanCount
135 }
136 i++
137 case "ASC":
138 desc = false
139 case "DESC":
140 desc = true
141 default:
142 err = fmt.Errorf("invalid argument %s", args[i])
143 return
144 }
145 i++
146 }
147 return
148}
149
150func parseScanArgs(args []string) (cursor []byte, match string, count int, desc bool, err error) {
151 cursor, match, count, desc, err = parseXScanArgs(args)
152 if bytes.Equal(cursor, nilCursorRedis) {
153 cursor = nilCursorLedis
154 }
155 return
156}
157
158type scanCommandGroup struct {
159 lastCursor []byte
160 parseArgs func(args []string) (cursor []byte, match string, count int, desc bool, err error)
161}
162
163// parseScanCount reads a COUNT argument and bounds it: COUNT is only a hint in
164// Redis, and the value sizes allocations inside the storage layer, so an
165// unbounded client value is a memory hazard rather than a page size.
166func parseScanCount(arg string) (int, error) {
167 n, err := strconv.Atoi(arg)
168 if err != nil || n <= 0 {
169 return 0, fmt.Errorf("ERR syntax error")
170 }
171 if n > maxScanCount {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected