func (s *Stack) Pop() string {
	s.lock.Lock()
	if s.len < s.maxSize {
		s.lock.Unlock()
		return ""
	}
	item := s.items.Front()
	if nil == item {
		s.lock.Unlock()
		return ""
	}
	s.items.Remove(item)
	s.len--
	id := item.Value.(string)
	delete(s.index, id)
	s.lock.Unlock()
	return id
}
Pop pops the first item from the stack
package chunk
import (
	"container/list"
	"sync"
)
type Stack struct {
	items   *list.List
	index   map[string]*list.Element
	len     int
	lock    sync.Mutex
	maxSize int
}
func NewStack(maxChunks int) *Stack {
	return &Stack{
		items:   list.New(),
		index:   make(map[string]*list.Element, maxChunks),
		maxSize: maxChunks,
	}
}