Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Iterator Functionality in Etcd Storage Adapter #841

Closed
shcorya opened this issue Jun 14, 2023 · 2 comments
Closed

Enable Iterator Functionality in Etcd Storage Adapter #841

shcorya opened this issue Jun 14, 2023 · 2 comments

Comments

@shcorya
Copy link

shcorya commented Jun 14, 2023

Describe the bug
The etcd storage package has no iterator function.

How To Reproduce
Running with the redis storage package iterates as described in the documentation. Running with the etcd storage package throws TypeError: keyv.iterator is not a function.

This code works:

const Keyv = require('keyv');
//const keyv = new Keyv('etcd://localhost:2379');
const keyv = new Keyv ('redis://localhost:6379');
(async () => {

    await keyv.set ('key1', 'value1');
    await keyv.set ('key2', 'value2')
    await keyv.set ('key3', 'value3');

    console.log(keyv.iterator()); // Return: Object [AsyncGenerator] {}
    for await (const [key, value] of keyv.iterator()) {
        console.log(key, value); // Return: key and value
    };

    keyv.disconnect ();

})();

Changing to etcd throws the error:

const Keyv = require('keyv');
const keyv = new Keyv('etcd://localhost:2379');
//const keyv = new Keyv ('redis://localhost:6379');
(async () => {

    await keyv.set ('key1', 'value1');
    await keyv.set ('key2', 'value2')
    await keyv.set ('key3', 'value3');

    console.log(keyv.iterator()); // TypeError: keyv.iterator is not a function
    for await (const [key, value] of keyv.iterator()) {
        console.log(key, value);
    };

    keyv.disconnect ();

})();
@shcorya shcorya added the bug label Jun 14, 2023
@jaredwray
Copy link
Owner

@shcorya - thanks so much for the issue post on this. Currently etcd does not have iteration enabled at the storage adapter layer. We will keep this open as it looks like we can enable this feature.

@jaredwray jaredwray changed the title etcd iterator Enable Iterator Functionality in Etcd Storage Adapter Jun 18, 2023
@jaredwray
Copy link
Owner

@shcorya - this has been resolved and should be released in the next couple weeks. #857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants