Add states to Event to handle incoming events

This commit is contained in:
Aaron Lindsay 2013-08-07 23:43:38 -04:00
parent 49b0f75714
commit e5fabc27e3
2 changed files with 6 additions and 0 deletions

View File

@ -164,6 +164,7 @@ func ProcessLocalEvent(globals AsinkGlobals, event *asink.Event) {
}
func ProcessRemoteEvent(globals AsinkGlobals, event *asink.Event) {
//TODO check to see if event originated locally. If it did, stop processing it.
//Download event
if event.IsUpdate() {
outfile, err := ioutil.TempFile(globals.tmpDir, "asink")

View File

@ -12,12 +12,17 @@ const (
type EventStatus uint32
const (
//the state of the event on the local asink instance on which it originated:
NOTICED = 1 << iota //watcher.go has been notified that a file changed
COPIED_TO_TMP //temporary version saved off
HASHED //hash taken of tmp file
CACHED //tmp file renamed to its hash
UPLOADED //tmp file has been successfully uploaded to storage
ON_SERVER //server has been successfully notified of event
//the state of the event on the asink instance notified that it occurred elsewhere
NOTIFIED //we've been told a file has been changed remotely
DOWNLOADED //event has been downloaded and stored in the local file cache
SYNCED //everything has been done to ensure the affected file is up-to-date
)
type Event struct {