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
32 lines
661 B
package messages
|
|
|
|
import "fmt"
|
|
|
|
type MessageBufferMover interface {
|
|
Setup()
|
|
TearDown()
|
|
MoveBuffer(buffer *MessageBuffer) (MessageBufferReference, error) // should be thread-safe
|
|
}
|
|
type MessageBufferReference struct {
|
|
sequence int64
|
|
fileId string
|
|
}
|
|
|
|
var _ = MessageBufferMover(&EmptyMover{})
|
|
|
|
type EmptyMover struct {
|
|
}
|
|
|
|
func (e *EmptyMover) Setup() {
|
|
}
|
|
|
|
func (e *EmptyMover) TearDown() {
|
|
}
|
|
|
|
func (e *EmptyMover) MoveBuffer(buffer *MessageBuffer) (MessageBufferReference, error) {
|
|
println("moving", buffer.sequenceBase)
|
|
return MessageBufferReference{
|
|
sequence: buffer.sequenceBase,
|
|
fileId: fmt.Sprintf("buffer %d", buffer.sequenceBase),
|
|
}, nil
|
|
}
|