Commit 1102a7d1 authored by Jeromy's avatar Jeromy

add 'KeyList' method to datastore

parent 504fee0a
...@@ -63,6 +63,15 @@ func (d *Datastore) Delete(key ds.Key) (err error) { ...@@ -63,6 +63,15 @@ func (d *Datastore) Delete(key ds.Key) (err error) {
return err return err
} }
func (d *Datastore) KeyList() []ds.Key {
i := d.DB.NewIterator(nil, nil)
var keys []ds.Key
for ; i.Valid(); i.Next() {
keys = append(keys, ds.NewKey(string(i.Key())))
}
return keys
}
// LevelDB needs to be closed. // LevelDB needs to be closed.
func (d *Datastore) Close() (err error) { func (d *Datastore) Close() (err error) {
return d.DB.Close() return d.DB.Close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment