joncrlsn/dque

DQue should be an Interface

nfoerster opened this issue · 0 comments

Although the current state works great, think about changing DQue as the return of New() to an interface. This makes it much easier for testing purposes. A dummy implementation of the interface would avoid any write/lock implications during testing.

type DQue interface {
  Close() error
  Enqueue(obj interface{}) error
  Dequeue() (interface{}, error)
  Peek() (interface{}, error)
  DequeueBlock() (interface{}, error)
  PeekBlock() (interface{}, error)
  Size() int
  SizeUnsafe() int
  SegmentNumbers() (int, int)
  Turbo() bool
  TurboOn() error
  TurboOff() error
  TurboSync() error
}