The World Is a libferris Filesystem
Listing 7. C++ Code Fragment Applying an XSLT to a Filesystem
fh_context c = Resolve( "~/example.odt/content.xml/" "office:document-content/office:body/office:text"); DOMDocument* theDOM = Factory::makeDOM( c ); ... // should use XercesDOMWrapperParsedSource XalanTransformer theXalanTransformer; theXalanTransformer.transform( theDOM, "~/my-oo.xsl", cout );
Recently, support for mounting applications such as Firefox, Evolution and the X Window System was added to libferris.
The evolution:// filesystem allows you to mount your Evolution mail client. Support currently extends to your mail folders and contacts. Using this filesystem, it is no longer necessary to save attachments to temporary files to access them from ferris-aware systems.
Mounting your X Window System is done via the xwin:// filesystem. This gives access to your window objects as well as lets you mount Klipper on KDE desktops. For Klipper, you can ls, cat and cp your past clipboard interactions easily, and overwriting the top clipboard element is effectively a clipboard copy. The window mounting lets you see where your windows are in terms of x,y offsets as well as other interesting data. Listing 8 shows a sample session of mounting my Evolution mail client and the X Window System.
Listing 8. Mounting Evolution and the X Window System
$ fls evolution://localhost contacts mail $ fls -0 evolution://localhost/contacts/system/ ... witme-ferris email@example.com ... $ fls -0 xwin://localhost/clipboard 0 #include <Ferris/Ferris.hh> 1 Let the cricket stick to its hearth 2 ...
Mounting databases allows you to explore the database server, its databases and their tables and views. Shown in Listing 9, I create a database, populate it and interact with it as a virtual filesystem. The final command using the --xml option for ferrisls exports each tuple in XML format.
Instead of embedding the user name and password in the URL, libferris elects to store this information in configuration files. This is a trade-off where the risk of accidentally copying and pasting a URL with embedded user credentials is minimized at the expense of having a central store of available credentials and mappings for where to use each credential. For many common URLs, inline authentication information is also supported.
Listing 9. PostgreSQL as a Filesystem
$ psql # create database tmp; # \c tmp # create table foo ( message varchar(100) not null, id int primary key ); # insert into foo values ( 'doki doki', 1 ); # \q $ fls -0 pg://localhost/tmp/foo doki doki 1 1 id $ fcat pg://localhost/tmp/foo/1 <context id="1" message="doki doki" /> $ echo "waku waku" | ferris-redirect \ -T --ea=message pg://localhost/tmp/foo/1 $ fls -0 pg://localhost/tmp/foo waku waku 1 1 id $ gfcreate pg://localhost/tmp/foo # See the gfcreate-tuple figure $ fls -0 pg://localhost/tmp/foo utsukushii 2 2 id $ psql tmp; # select * from foo; message | id ------------------------+---- waku waku | 1 utsukushii | 2
The invocation of gfcreate shown in Listing 9 is captured in Figure 1.
A libferris filesystem can nominate which objects it is happy to have created on it. You can see this list by using the fcreate or gfcreate tools in the ferriscreate package. A large list of possibilities will be displayed for an fcreate -l /tmp, for example. For a PostgreSQL database, you can create only a small number of new object types, as shown in Listing 10. I'll use fcreate in a moment to create a new empty db4 file to show how filesystem monitoring is virtualized in libferris.
Listing 10. What types of things can I create for a PostgreSQL filesystem?
$ fcreate -l pg://localhost/tmp listing types that can be created for context: pg:///localhost/tmp queryview table $ fcreate -l pg://localhost/tmp/foo listing types that can be created for context: pg:///localhost/tmp/foo tuple
Many changes made to a libferris filesystem are reflected instantly in other libferris applications. Many kernel-level interfaces let applications know when a kernel filesystem changes—for example, inotify and dnotify. libferris extends this to allow clients to know when a virtual filesystem has changed. For example, when you update an element inside of an XML file, inotify tells you only that the XML file has changed. With libferris, you can see exactly which part of the XML file was modified by other libferris applications.
Listing 11 demonstrates the filesystem monitoring support. In the example, I use the --monitor-all option of ferrisls. This makes ferrisls operate like a tail -f for your given URL; any creation, deletion or interesting filesystem activity is shown on the console. In another terminal, Listing 12, I'm creating, deleting and writing to “files” inside a Berkeley db4 file. ferrisls happily reports what is happening to these virtual files.
|Happy Birthday Linux||Aug 25, 2016|
|ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs||Aug 24, 2016|
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
|What I Wish I’d Known When I Was an Embedded Linux Newbie||Aug 18, 2016|
|Pandas||Aug 17, 2016|
- Happy Birthday Linux
- ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs
- Updates from LinuxCon and ContainerCon, Toronto, August 2016
- What I Wish I’d Known When I Was an Embedded Linux Newbie
- New Version of GParted
- Tor 0.2.8.6 Is Released
- NVMe over Fabrics Support Coming to the Linux 4.8 Kernel
- All about printf
- Blender for Visual Effects
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide