MCPcopy Create free account
hub / github.com/beeker1121/goque / init

Method init

stack.go:315–331  ·  view source on GitHub ↗

init initializes the stack data.

()

Source from the content-addressed store, hash-verified

313
314// init initializes the stack data.
315func (s *Stack) init() error {
316 // Create a new LevelDB Iterator.
317 iter := s.db.NewIterator(nil, nil)
318 defer iter.Release()
319
320 // Set stack head to the last item.
321 if iter.Last() {
322 s.head = keyToID(iter.Key())
323 }
324
325 // Set stack tail to the first item.
326 if iter.First() {
327 s.tail = keyToID(iter.Key()) - 1
328 }
329
330 return iter.Error()
331}

Callers 1

OpenStackFunction · 0.95

Calls 1

keyToIDFunction · 0.85

Tested by

no test coverage detected