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

Method Close

stack.go:263–284  ·  view source on GitHub ↗

Close closes the LevelDB database of the stack.

()

Source from the content-addressed store, hash-verified

261
262// Close closes the LevelDB database of the stack.
263func (s *Stack) Close() error {
264 s.Lock()
265 defer s.Unlock()
266
267 // Check if stack is already closed.
268 if !s.isOpen {
269 return nil
270 }
271
272 // Close the LevelDB database.
273 if err := s.db.Close(); err != nil {
274 return err
275 }
276
277 // Reset stack head and tail and set
278 // isOpen to false.
279 s.head = 0
280 s.tail = 0
281 s.isOpen = false
282
283 return nil
284}
285
286// Drop closes and deletes the LevelDB database of the stack.
287func (s *Stack) Drop() error {

Callers 15

DropMethod · 0.95
checkGoqueTypeFunction · 0.45
TestStackCloseFunction · 0.45
TestPrefixQueueCloseFunction · 0.45
Example_prefixQueueFunction · 0.45
TestQueueCloseFunction · 0.45
Example_queueFunction · 0.45
Example_priorityQueueFunction · 0.45
TestPriorityQueueCloseFunction · 0.45

Calls

no outgoing calls

Tested by 13

TestStackCloseFunction · 0.36
TestPrefixQueueCloseFunction · 0.36
Example_prefixQueueFunction · 0.36
TestQueueCloseFunction · 0.36
Example_queueFunction · 0.36
Example_priorityQueueFunction · 0.36
TestPriorityQueueCloseFunction · 0.36
Example_stackFunction · 0.36