You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Benson Margulies <be...@basistech.com> on 2015/05/08 13:09:48 UTC

Read-only cache

Once I have provisioned some bundles into the container, can I treat it as
read-only and share it between processes?

Re: Read-only cache

Posted by Benson Margulies <be...@basistech.com>.
On Fri, May 8, 2015 at 8:17 AM, Neil Bartlett <nj...@gmail.com> wrote:

> OSGi framework instances should NOT share a storage directory. As far as I
> know, no framework implementation uses file locking to protect against
> concurrent modification by other processes, nor does the OSGi spec does not
> require them to do so. Also, even if the framework itself was safe, bundles
> could conflict in their own access to the storage area.
>

As it happens, Knopflerfish has a readonly mode which permits sharing a
provisioned storage directory. Unfortunately, it does not do what I need
for data associated with bundles -- it just disables all access to storage
instead of treating it as read-only.

I suppose i could try to sell a patch for this purpose to the dev list, I'm
not sure I'm prepared to climb that hill.



>
> You MAY be able to do this safely using mechanisms outside of OSGi, e.g.
> running the framework once to extract all your data and them making the
> directory read-only at the Operation System level. But then there is no
> guarantee that the framework would be able to start at all without a
> writable storage area.
>
> So I think you would be better off finding a different solution.
>
> Regards,
> Neil
>
>
>
> > On 8 May 2015, at 12:44, Benson Margulies <be...@basistech.com> wrote:
> >
> > Let me expand on my own question.
> >
> > My goal is to provision some bundles, including some fragments that
> unpack
> > to large amounts of data in bundle storage. (Using
> > BundleContext.getDataFile()). I want to then treat this as frozen -- no
> new
> > bundles, and the data is a shared, read-only resource.  Using the
> > properties below, can I do this? Or do I need to design a different
> > architecture in which my shared material is not inside of the container
> > after all?
> >
> >   - org.osgi.framework.storage - Sets the directory to use as the bundle
> >   cache; by default the bundle cache directory is felix-cache in the
> >   current working directory. The value should be a valid directory name.
> The
> >   directory name can be either absolute or relative. Relative directory
> names
> >   are relative to the current working directory. The specified directory
> will
> >   be created if it does not exist.
> >   - felix.cache.rootdir - Sets the root directory used to calculate the
> >   bundle cache directory for relative directory names. If
> >   org.osgi.framework.storage is set to a relative name, by default it is
> >   relative to the current working directory. If this property is set,
> then it
> >   will be calculated as being relative to the specified root directory.
> >
> >
> > On Fri, May 8, 2015 at 7:09 AM, Benson Margulies <be...@basistech.com>
> > wrote:
> >
> >> Once I have provisioned some bundles into the container, can I treat it
> as
> >> read-only and share it between processes?
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Read-only cache

Posted by Neil Bartlett <nj...@gmail.com>.
OSGi framework instances should NOT share a storage directory. As far as I know, no framework implementation uses file locking to protect against concurrent modification by other processes, nor does the OSGi spec does not require them to do so. Also, even if the framework itself was safe, bundles could conflict in their own access to the storage area.

You MAY be able to do this safely using mechanisms outside of OSGi, e.g. running the framework once to extract all your data and them making the directory read-only at the Operation System level. But then there is no guarantee that the framework would be able to start at all without a writable storage area.

So I think you would be better off finding a different solution.

Regards,
Neil



> On 8 May 2015, at 12:44, Benson Margulies <be...@basistech.com> wrote:
> 
> Let me expand on my own question.
> 
> My goal is to provision some bundles, including some fragments that unpack
> to large amounts of data in bundle storage. (Using
> BundleContext.getDataFile()). I want to then treat this as frozen -- no new
> bundles, and the data is a shared, read-only resource.  Using the
> properties below, can I do this? Or do I need to design a different
> architecture in which my shared material is not inside of the container
> after all?
> 
>   - org.osgi.framework.storage - Sets the directory to use as the bundle
>   cache; by default the bundle cache directory is felix-cache in the
>   current working directory. The value should be a valid directory name. The
>   directory name can be either absolute or relative. Relative directory names
>   are relative to the current working directory. The specified directory will
>   be created if it does not exist.
>   - felix.cache.rootdir - Sets the root directory used to calculate the
>   bundle cache directory for relative directory names. If
>   org.osgi.framework.storage is set to a relative name, by default it is
>   relative to the current working directory. If this property is set, then it
>   will be calculated as being relative to the specified root directory.
> 
> 
> On Fri, May 8, 2015 at 7:09 AM, Benson Margulies <be...@basistech.com>
> wrote:
> 
>> Once I have provisioned some bundles into the container, can I treat it as
>> read-only and share it between processes?
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Read-only cache

Posted by Benson Margulies <be...@basistech.com>.
Let me expand on my own question.

My goal is to provision some bundles, including some fragments that unpack
to large amounts of data in bundle storage. (Using
BundleContext.getDataFile()). I want to then treat this as frozen -- no new
bundles, and the data is a shared, read-only resource.  Using the
properties below, can I do this? Or do I need to design a different
architecture in which my shared material is not inside of the container
after all?

   - org.osgi.framework.storage - Sets the directory to use as the bundle
   cache; by default the bundle cache directory is felix-cache in the
   current working directory. The value should be a valid directory name. The
   directory name can be either absolute or relative. Relative directory names
   are relative to the current working directory. The specified directory will
   be created if it does not exist.
   - felix.cache.rootdir - Sets the root directory used to calculate the
   bundle cache directory for relative directory names. If
   org.osgi.framework.storage is set to a relative name, by default it is
   relative to the current working directory. If this property is set, then it
   will be calculated as being relative to the specified root directory.


On Fri, May 8, 2015 at 7:09 AM, Benson Margulies <be...@basistech.com>
wrote:

> Once I have provisioned some bundles into the container, can I treat it as
> read-only and share it between processes?
>
>