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

Method cmdXSSCAN

scan.go:171–203  ·  view source on GitHub ↗

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

(_ uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

169 return 0, fmt.Errorf("ERR syntax error")
170 }
171 if n > maxScanCount {
172 n = maxScanCount
173 }
174 return n, nil
175}
176
177// compileGlob turns a Redis glob into the regexp used to filter results in the
178// handler rather than in the storage layer.
179func compileGlob(pattern string) (*regexp.Regexp, error) {
180 re, err := regexp.Compile(globToRegex(pattern))
181 if err != nil {
182 return nil, fmt.Errorf("ERR invalid pattern")
183 }
184 return re, nil
185}
186
187// maxScanCount caps the COUNT hint. Redis treats COUNT as a hint, and the value
188// sizes allocations inside the engine, so an unbounded client value is a memory
189// hazard rather than a query the caller can rely on.
190const maxScanCount = 10000
191
192// scanTypeOrder is the fixed order in which SCAN walks the engine's per-type
193// keyspaces.
194var scanTypeOrder = []struct {
195 name string
196 dataType ledis.DataType
197}{
198 {"string", ledis.KV},
199 {"hash", ledis.HASH},
200 {"list", ledis.LIST},
201 {"set", ledis.SET},
202 {"zset", ledis.ZSET},
203}
204
205// scanTypeCursor is the resume point of one keyspace.
206type scanTypeCursor struct {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected