[Yanel-development] [yarep] fallback not working

Josias Thöny josias.thoeny at wyona.com
Fri Nov 17 09:28:20 CET 2006


On Wed, 2006-11-15 at 23:29 +0100, Michael Wechner wrote:
> Josias Thöny wrote:
> 
> >Hi all,
> >
> >This is a yarep question. Sorry for posting to the yanel list. Is there
> >a better place for yarep questions?
> >  
> >
> 
> not yet ;-)
> 
> >The fallback mechanism of yarep allows to access files in the repository
> >which are not registered in the uid/path map.
> >  
> >
> 
> right
> 
> >If you want to read the content for a given path from yarep, and the
> >path is not found in the uid/path map, it will assume that path=uid and
> >read that path directly from the repository.
> >
> >There is a problem with this approach:
> >- say there is a file /foo.txt in the repository, but it's not
> >registered in the path-map.
> >- someone reads the path "/foo.txt". it will work.
> >- now someone writes to this path. since the map has no uid for this
> >path, one will be created, say 1234, and the content will be written to
> >the file /1234
> >
> >This means we now have two different files for the same path in the
> >repository, which is bad.
> >
> >Furthermore, methods like getChildren() or delete() do not work if the
> >path is not registered in the map.
> >
> >I therefore propose to remove the fallback, unless someone has an idea
> >how to fix it.
> >  
> >
> 
> I think we should fix it somehow and I hope we are able to ;-)

What about the following situation:

Assume there is a path /abc.html which has the uid /a.html:
path: /abc.html -> uid: /a.html

Now someone wants to write to the path /a.html
What should the repository do? 
Currently it does the following:
- Look up in the map 
-> no uid exists for path /a.html 
-> uid 1234 will be created 
-> content will be written to /1234

If you allow fallback in the write method, this will happen:
-> no uid exists for path /a.html 
-> check if file /a.html exists in the repo content -> yes!
-> write to file /a.html

Now we have overwritten the content of path /abc.html

I don't think the fallback can be fixed, because it's not clean.

> 
> It also took me quite some time to introduce the fallback because
> I also thought that it is "evil", but there is a lot of existing data
> for which it would be nice use the Path/Map repo implementation, but at 
> the same time one would have to create all map entries. Well, one could 
> argue to write an import method
> 
> >It probably could be replaced by a special map implementation which
> >directly maps paths to uids.
> >
> such an implementation exist namely the VFileSystemImplementation, but it
> had the disadvantage that "/" cannot be translated into for instance 
> /index.html

Ok, let's use this implementation then. What does the V stand for?
virtual?
Actually if we want to have an implementation which directly maps the
paths to the fs, I don't think it's the job of such an implementation to
translate paths like you mentioned.

josias

> 
> >WDYT? 
> >  
> >
> 
> I would suggest that we implement fallback also for the following cases:
> 
> - add
> - delete
> - getChildren
> - ...
> 
> but yes, the question is if this is actually going to end ...
> 
> WDYT?
> 
> Michi
> 
> >Josias
> >
> >
> >
> >_______________________________________________
> >Yanel-development mailing list
> >Yanel-development at wyona.com
> >http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
> >
> >  
> >
> 
> 




More information about the Yanel-development mailing list