implement new kvstore api

and refactor the tests using kvstore/testutil.