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

Request : Add last() to p1_queue #6

Open
grizzly-monkey opened this issue Apr 20, 2017 · 6 comments
Open

Request : Add last() to p1_queue #6

grizzly-monkey opened this issue Apr 20, 2017 · 6 comments
Assignees

Comments

@grizzly-monkey
Copy link

Can we please add functionality to get last element from queue()

Thanks
Jeet

@zinid
Copy link
Contributor

zinid commented Apr 20, 2017

Only if we can make the operation O(1), which is doubtful without changing file queue format.

@grizzly-monkey
Copy link
Author

what is current file queue format why will it not be done in o(1) can we not peek to the last entry ?

@zinid
Copy link
Contributor

zinid commented Apr 21, 2017

The current format is:

<<Size:32, BinaryTerm:Size/binary, ...>>

So, obviously, we can only peek in O(N) to the last element. In order to peek in O(1), we need to have something like:

<<Size:32, BinaryTerm:Size/binary, Size:32, ...>>

@grizzly-monkey
Copy link
Author

Thanks for the clarity @zinid for now i am using ram queues so without changing p1_q i am managing last in my module.
However if we can get this change in p1_q it would be awesome i am not sure how big this change format is for file queue but if we can get this it will be really great .

@zinid zinid self-assigned this Apr 21, 2017
@zinid
Copy link
Contributor

zinid commented Apr 21, 2017

OK, I will try to look at it ASAP.

@grizzly-monkey
Copy link
Author

Thank you Sir.

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