apso-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Apso-devel] The refactoring/cleanup


From: Jeronimo Pellegrini
Subject: Re: [Apso-devel] The refactoring/cleanup
Date: Sat, 18 Nov 2006 06:33:29 -0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hi Stuart.

On Sat, Nov 18, 2006 at 12:30:12PM +0800, stuarthu wrote:
> Jeronimo Pellegrini wrote:
> >Cryptengine::instance("nettle"); // Returns a specific instance
> >Cryptengine::instance("another"); // Returns a different cryptengine
> >
> >This will be useful in the future if we want to translate one
> >PubRepository into another (for example, translating a Nettle
> >PubRepository directly into a Botan PubRepository)
> >  
>   This feather is probably not what we really want I'm afraid. I 
> suggest to keep apso simple and stupid. The translation of pub 
> repository could be achieved like this:
>           decrypt to a private rep with the old ce
>           encrypt to a new public rep with a different ce
>   We can run the apso process twice to do this job. It will be much 
> easier to understand than to do it in a single run.

Then the user would need some extra disk space -- and one extra step.

>   I think apso should need only 1 vc system, 1 ce, and 1 command in 
> it's process's lifetime. Thus we provide our users a mechanism with a 
> minimal interface. So that they can introduce their own policies, rather 
> than remember all the complicated commands we gave.
>   What do you think :)

That is a good point.

> >(That was the idea behind directory.h) BTW, you mentioned that
> >you couldn't compile it; that is probably because you have pulled
> >revision 21053b9d7a571cd41a0ae89e750f2ef0a53efdf1, which had a
> >version of directory.h which caused a build failure. Please resync
> >and it will work)
> >  
>   Directory template class is useful in case that a number of classes 
> need to be referenced via it's name. But since apso only need 1 vc, 1 ce 
> and 1 command, I don't see much of the need to use it. What we need is a 
> factory method to create the vc, ce, and command that user indicated in 
> the command line. After that, apso can simply use them via a base class 
> reference.
>   What do you think :)

Yes, taking them via base class reference is what I had in mind.
Directory can behave similar to a factory, except that it does need
an instance in the moment that the subclass is created.

Cryptengine::register ("nettle", CryptEngineNettle_ptr);
Cryptengine::register ("botan",  CryptengineBotan_ptr);
Cryptenging::set_default ("nettle");
...

Cryptenging::instance();


But you have a good point also. So, basically we have two ways of doing
things.

First:
- Use a factory method with one subclass instance per class
  This will simplify things somewhat

Second:
- Use a directory of classes
  This would allow us to use more than one cryptengine/VCS without
  running Apso more than once

But you know -- maybe we can also use the factory for more than one instance
later, changing it a little, so let's use your idea of using Command and
Factory.

One thing -- please use boost::shared_ptr, even inside the factory.

J.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]