You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
661 B

2 years ago
2 years ago
2 years ago
  1. package messages
  2. import "fmt"
  3. type MessageBufferMover interface {
  4. Setup()
  5. TearDown()
  6. MoveBuffer(buffer *MessageBuffer) (MessageBufferReference, error) // should be thread-safe
  7. }
  8. type MessageBufferReference struct {
  9. sequence int64
  10. fileId string
  11. }
  12. var _ = MessageBufferMover(&EmptyMover{})
  13. type EmptyMover struct {
  14. }
  15. func (e *EmptyMover) Setup() {
  16. }
  17. func (e *EmptyMover) TearDown() {
  18. }
  19. func (e *EmptyMover) MoveBuffer(buffer *MessageBuffer) (MessageBufferReference, error) {
  20. println("moving", buffer.sequenceBase)
  21. return MessageBufferReference{
  22. sequence: buffer.sequenceBase,
  23. fileId: fmt.Sprintf("buffer %d", buffer.sequenceBase),
  24. }, nil
  25. }