X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=cmd%2Fsdltester%2Fsdltester.go;h=9f6e49308b4fa5b7ba96b3f8c623e4a6606235a4;hb=refs%2Fchanges%2F65%2F6765%2F3;hp=f2eb379c2e4fca7325bd9b890bd5fd5f52911d51;hpb=354c65d7e6d9269e62b88b1804443513e55f4889;p=ric-plt%2Fsdlgo.git diff --git a/cmd/sdltester/sdltester.go b/cmd/sdltester/sdltester.go index f2eb379..9f6e493 100644 --- a/cmd/sdltester/sdltester.go +++ b/cmd/sdltester/sdltester.go @@ -79,6 +79,8 @@ func main() { noexist(sdl) case "getall": getall(sdl) + case "listkeys": + listkeys(sdl) case "removeall": removeall(sdl) case "emptymap": @@ -112,6 +114,7 @@ func printHelp() { fmt.Println(" found") fmt.Println("getall Read all keys within a namespace. One can manually add keys under the used namespace and all") fmt.Println(" those keys should be returned here. Performance is measured") + fmt.Println("listkeys List keys in the given namespace matching key search pattern.") fmt.Println("removeall Remove all keys within a namespace. Performance is measured") fmt.Println("emptymap Write an empty container. Performance is measured") fmt.Println("multiple Make two writes. Performance is measured") @@ -193,6 +196,22 @@ func getall(sdl *sdlgo.SyncStorage) { } } +func listkeys(sdl *sdlgo.SyncStorage) { + start := time.Now() + ns := "tag1" + pattern := "*" + keys, err := sdl.ListKeys(ns, pattern) + elapsed := time.Since(start) + if err == nil { + fmt.Printf("ListKeys(%s, %s): %s\n", ns, pattern, elapsed) + for _, i := range keys { + fmt.Println(i) + } + } else { + fmt.Println(err) + } +} + func removeall(sdl *sdlgo.SyncStorage) { start := time.Now() err := sdl.RemoveAll("tag1")