This commit is contained in:
Axel Kittenberger 2010-10-22 13:12:13 +00:00
parent e23328f737
commit 417ddc79fe
1 changed files with 20 additions and 15 deletions

View File

@ -74,6 +74,7 @@ targets = {}
--
watches = {}
------
-- TODO
collapse_table = {
[ATTRIB] = { [ATTRIB] = ATTRIB, [MODIFY] = MODIFY, [CREATE] = CREATE, [DELETE] = DELETE },
@ -82,10 +83,23 @@ collapse_table = {
[DELETE] = { [ATTRIB] = DELETE, [MODIFY] = DELETE, [CREATE] = MODIFY, [DELETE] = DELETE },
}
-----
-- A list of names of the event types the core sends.
--
local event_names = {
[ATTRIB ] = "Attrib",
[MODIFY ] = "Modify",
[CREATE ] = "Create",
[DELETE ] = "Delete",
[MOVE ] = "Move",
[MOVEFROM ] = "MoveFrom",
[MOVETO ] = "MoveTo",
}
-----
-- TODO
local function delay_action(atype, target, time, wd, odir, path)
local function delay_action(atype, wd, sync, filename, time)
print("delay_action "..event_names[atype].."("..wd..") ")
-- TODO
end
@ -117,7 +131,7 @@ local function attend_dir(origin, path, parent)
-- warmstart?
if origin.actions.startup == nil then
delay_action(CREATE, target, nil, wd, origin, path)
delay_action(CREATE, wd, sync, nil, nil)
end
-- register all subdirectories
@ -189,19 +203,6 @@ function lsyncd_get_alarm()
return 0, 0
end
-----
-- A list of names of the event types the core sends.
--
local event_names = {
[ATTRIB ] = "Attrib",
[MODIFY ] = "Modify",
[CREATE ] = "Create",
[DELETE ] = "Delete",
[MOVE ] = "Move",
[MOVEFROM ] = "MoveFrom",
[MOVETO ] = "MoveTo",
}
-----
-- Called by core on inotify event
--
@ -233,6 +234,10 @@ function lsyncd_event(etype, wd, isdir, filename, filename2)
-- works through all possible source->target pairs
for i, sync in ipairs(w.syncs) do
time = nil -- TODO
delay_action(etype, wd, sync, filename, time)
-- add subdirs for new directories
if isdir and eypte == CREATE then
attend_dir(sync.origin, sync.path..filename.."/", w)
end