def scan(self, cursor=<NUM_LIT:0>, match=None, count=None):
f = Future()<EOL>if self.keyspace is None:<EOL><INDENT>with self.pipe as pipe:<EOL><INDENT>res = pipe.scan(cursor=cursor, match=match, count=count)<EOL>def cb():<EOL><INDENT>f.set((res[<NUM_LIT:0>], [self.keyparse.decode(v) for v in res[<NUM_LIT:1>]]))<EOL><DEDENT>pipe.on_execute(cb)<EOL>return f<EOL><DEDENT><DEDENT>if match is None:<EOL><INDENT>match = '<STR_LIT:*>'<EOL><DEDENT>match = "<STR_LIT>" % (self.keyspace, match)<EOL>pattern = re.compile(r'<STR_LIT>' % self.keyspace)<EOL>with self.pipe as pipe:<EOL><INDENT>res = pipe.scan(cursor=cursor, match=match, count=count)<EOL>def cb():<EOL><INDENT>keys = []<EOL>for k in res[<NUM_LIT:1>]:<EOL><INDENT>k = self.keyparse.decode(k)<EOL>m = pattern.match(k)<EOL>if m:<EOL><INDENT>keys.append(m.group(<NUM_LIT:1>))<EOL><DEDENT><DEDENT>f.set((res[<NUM_LIT:0>], keys))<EOL><DEDENT>pipe.on_execute(cb)<EOL>return f<EOL><DEDENT>
Incrementally return lists of key names. Also return a cursor
indicating the scan position.

``match`` allows for filtering the keys by pattern

``count`` allows for hint the minimum number of returns