Add states to Event to handle incoming events
This commit is contained in:
parent
49b0f75714
commit
e5fabc27e3
@ -164,6 +164,7 @@ func ProcessLocalEvent(globals AsinkGlobals, event *asink.Event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ProcessRemoteEvent(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
|
//Download event
|
||||||
if event.IsUpdate() {
|
if event.IsUpdate() {
|
||||||
outfile, err := ioutil.TempFile(globals.tmpDir, "asink")
|
outfile, err := ioutil.TempFile(globals.tmpDir, "asink")
|
||||||
|
@ -12,12 +12,17 @@ const (
|
|||||||
type EventStatus uint32
|
type EventStatus uint32
|
||||||
|
|
||||||
const (
|
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
|
NOTICED = 1 << iota //watcher.go has been notified that a file changed
|
||||||
COPIED_TO_TMP //temporary version saved off
|
COPIED_TO_TMP //temporary version saved off
|
||||||
HASHED //hash taken of tmp file
|
HASHED //hash taken of tmp file
|
||||||
CACHED //tmp file renamed to its hash
|
CACHED //tmp file renamed to its hash
|
||||||
UPLOADED //tmp file has been successfully uploaded to storage
|
UPLOADED //tmp file has been successfully uploaded to storage
|
||||||
ON_SERVER //server has been successfully notified of event
|
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 {
|
type Event struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user