1
0
mirror of https://github.com/taigrr/bitcask synced 2025-01-18 04:03:17 -08:00

Add Keys() to exported API (extended API)

This commit is contained in:
James Mills
2019-03-21 10:41:56 +10:00
parent 01cb269a51
commit aaea7273c3
3 changed files with 16 additions and 2 deletions

View File

@@ -55,8 +55,10 @@ func (k *Keydir) Delete(key string) {
func (k *Keydir) Keys() chan string {
ch := make(chan string)
go func() {
for k := range k.kv {
ch <- k
k.RLock()
defer k.RUnlock()
for key := range k.kv {
ch <- key
}
close(ch)
}()