mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
33 lines
658 B
Go
33 lines
658 B
Go
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
|
|
}
|