mtsatellite/cmd/mtredisalize/changetracker.go

34 lines
625 B
Go
Raw Normal View History

package main
import (
"log"
"sync"
"bitbucket.org/s_l_teichmann/mtredisalize/common"
)
type ChangeTracker struct {
mutex sync.Mutex
}
func NewChangeTracker() *ChangeTracker {
return &ChangeTracker{}
}
func (ct *ChangeTracker) BlockChanged(key []byte) {
ct.mutex.Lock()
defer ct.mutex.Unlock()
var err error
var coord common.Coord
if coord, err = common.DecodeStringBytesToCoord(key); err != nil {
log.Printf("decoding key failed: %s", err)
return
}
log.Printf("changed block: %v", coord)
}
func (ct *ChangeTracker) FlushChanges(url string) (err error) {
log.Println("change flush triggered")
return
}