mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-06-14 22:22:22 +00:00
This commit is contained in:
parent
e23328f737
commit
417ddc79fe
35
lsyncd.lua
35
lsyncd.lua
|
@ -74,6 +74,7 @@ targets = {}
|
||||||
--
|
--
|
||||||
watches = {}
|
watches = {}
|
||||||
|
|
||||||
|
------
|
||||||
-- TODO
|
-- TODO
|
||||||
collapse_table = {
|
collapse_table = {
|
||||||
[ATTRIB] = { [ATTRIB] = ATTRIB, [MODIFY] = MODIFY, [CREATE] = CREATE, [DELETE] = DELETE },
|
[ATTRIB] = { [ATTRIB] = ATTRIB, [MODIFY] = MODIFY, [CREATE] = CREATE, [DELETE] = DELETE },
|
||||||
|
@ -82,10 +83,23 @@ collapse_table = {
|
||||||
[DELETE] = { [ATTRIB] = DELETE, [MODIFY] = DELETE, [CREATE] = MODIFY, [DELETE] = DELETE },
|
[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
|
-- 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
|
-- TODO
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -117,7 +131,7 @@ local function attend_dir(origin, path, parent)
|
||||||
|
|
||||||
-- warmstart?
|
-- warmstart?
|
||||||
if origin.actions.startup == nil then
|
if origin.actions.startup == nil then
|
||||||
delay_action(CREATE, target, nil, wd, origin, path)
|
delay_action(CREATE, wd, sync, nil, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- register all subdirectories
|
-- register all subdirectories
|
||||||
|
@ -189,19 +203,6 @@ function lsyncd_get_alarm()
|
||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
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
|
-- 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
|
-- works through all possible source->target pairs
|
||||||
for i, sync in ipairs(w.syncs) do
|
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
|
if isdir and eypte == CREATE then
|
||||||
attend_dir(sync.origin, sync.path..filename.."/", w)
|
attend_dir(sync.origin, sync.path..filename.."/", w)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user