mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-08 11:10:27 +01:00
34 lines
625 B
Go
34 lines
625 B
Go
|
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
|
||
|
}
|