Documentation ¶
Overview ¶
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Author: anupam.kapoor@gmail.com (Anupam Kapoor)
this package provides an implementation of a 'chunked' stack. each element in the stack is a chunk of 'MAX_ITEMS_PER_CHUNK' elements.
Index ¶
Constants ¶
const MAX_ITEMS_PER_CHUNK = 4096
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChunkedStack ¶
type ChunkedStack struct {
// contains filtered or unexported fields
}
a stack made out of list of chunk elements
func (*ChunkedStack) Empty ¶
func (cs *ChunkedStack) Empty() bool
func (*ChunkedStack) Len ¶
func (cs *ChunkedStack) Len() int32
func (*ChunkedStack) Pop ¶
func (cs *ChunkedStack) Pop() (item Data)
this function is called to remove an item from the stack. when the number of items in a chunk drops to 0, it is removed from the stack.
func (*ChunkedStack) Push ¶
func (cs *ChunkedStack) Push(item Data)
this function is called to add an item to the top of the stack. grow the stack by a chunk if required.