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
Add option to allow pushing on a Stack when this is full #45
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given that our concept of a Stack is vertical, with elements being on top of others, it is more convenient to have frames up or down, instead of previous or next.
Codecov Report
@@ Coverage Diff @@
## dev-0.2 #45 +/- ##
======================================
Coverage 100% 100%
======================================
Files 18 18
Lines 679 756 +77
======================================
+ Hits 679 756 +77
Continue to review full report at Codecov.
|
When sweeping a single element, its value was still available as Peek value. This commits cleans all content of the Stack when a single element is swept.
Panic 💣
How to reproduce?
|
fern4lvarez
changed the title
Add option to rotate Stack elements when pushing on a full one
Add option allow pushing on a Stack when this is empty
Feb 13, 2017
fern4lvarez
changed the title
Add option allow pushing on a Stack when this is empty
Add option to allow pushing on a Stack when this is full
Feb 13, 2017
With this commit, if we are allowed to push when the Stack is full, pilad will do a sweep and push as a single operation, to provide atomicity.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously (0.1.X), when a Stack is full,
PUSH
operation is unavailable, returning406 NOT ACCEPTABLE
.This change provides a new config value, of boolean type:
PILADB_PUSH_WHEN_FULL
as environment variable.-push-when-full
as CLI parameter.When this value is set to
true
,PUSH
operations on a full Stack will be accepted, removing the bottommost element from the Stack.This PR also adds a new
Sweep
method to the Stack, which will remove the bottommost element from the Stack, returning such element and an OK if it was successfull. Note that the method is implemented at the Stack level, but there's no suchSWEEP
operation from the outside of a Pila.