diffable works

9 views
Skip to first unread message

gongxun ji

unread,
Aug 16, 2010, 11:02:46 PM8/16/10
to Diffable
Hi Joshua:
i make a demo, it works, so great, thank you!
and i got some other questions. +.+
the deltas compare the contents like cvs? how diffable know the
content is new. or the content is modify.
if i changed the whole content, so the deltas will be the new.
so the deltas is plus or overwrite. the file name is not changed, the
deltas will be add in the old content?

Joshua Harrison

unread,
Aug 17, 2010, 12:45:46 AM8/17/10
to Diffable
I'm glad it's working for you! :)

File changes are determined by comparing the last modified time of the
resource store folder against the last modified time of the resource
itself. Whenever the resource changes, deltas are generated and the
last modified time of the resource folder is updated.

The ResourceManager interface is responsible for performing these
checks. The FileResourceManager provides a file-system based
implementation of this interface, and the code for performing the
check is located on line 212:
http://code.google.com/p/diffable/source/browse/trunk/j2ee-diffable/src/main/java/com/google/diffable/data/FileResourceManager.java#212

If you change the whole content of a file, there are two options:

1.) Change the name of the resource. The FileResourceManager will see
it as a new resource and it will be managed/versioned separately.
This is probably the easiest path.

2.) The second option is to delete the corresponding resource store
folder for the given resource. This is a little more difficult as
there isn't a straightforward way to identify which folder corresponds
to which managed resource, since the folder names are hashes of the
resource path. But if you look at the contents of the files within a
resource store folder, you should be able to identify which resource
is being stored in which folder. Once you know for sure, if you
delete the folder, then the monitor will recreate it with the current
version of the file being the starting point for creating deltas.

I have created an issue around this though so that a more sane system
can be devised: http://code.google.com/p/diffable/issues/detail?id=15

gongxun ji

unread,
Aug 25, 2010, 10:14:22 PM8/25/10
to Diffable
HI Joshua:
it's me again. i got the src code. Notice the
ResourceMonitor.java, is this ResourceMonitor check the file modified
or not in other thread and change the last modify time of the
resource? is the ResourceMonitor get too much cpu resource?
if the interval time is 24Hour(i chaged the interval time),
in the 24hour i chaged the script file. so the deltas will generate in
the request time, right? the ResourceMonitor only a prevent wait on
diaffable in the request. i don't know am i express my mind.
there two ways to generate deltas. one is the ResourceMonitor
file generate in the server, the other way is in the request, but may
be wait a moment or a long timeto generate the deltas?

On Aug 17, 12:45 pm, Joshua Harrison <joshharri...@google.com> wrote:
> I'm glad it's working for you!  :)
>
> File changes are determined by comparing the last modified time of the
> resource store folder against the last modified time of the resource
> itself.  Whenever the resource changes, deltas are generated and the
> last modified time of the resource folder is updated.
>
> The ResourceManager interface is responsible for performing these
> checks.  The FileResourceManager provides a file-system based
> implementation of this interface, and the code for performing the
> check is located on line 212:http://code.google.com/p/diffable/source/browse/trunk/j2ee-diffable/s...

Joshua Harrison

unread,
Aug 26, 2010, 1:04:54 PM8/26/10
to Diffable
I don't see why there would be any issue with increasing the
ResourceMonitor's wait time for as long as you want. I could even
imagine a code change where the interval was set to negative and this
would disable the ResourceMonitor. Since deltas are generated on
server start-up as well, you could maybe add code to disable the
ResourceMonitor and then just restart the server when new versions of
the JS are deployed. Does this answer your question?

Joshua
Reply all
Reply to author
Forward
0 new messages