Layered Library Design

Each of Subversion’s core libraries can be said to exist in one of three main layers—the Repository layer, the Repository Access (RA) layer, or the Client layer (see Figure 1 in the Preface). We will examine these layers shortly, but first, let’s briefly summarize Subversion’s various libraries. For the sake of consistency, we will refer to the libraries by their extensionless Unix library names (libsvn_fs, libsvn_wc, mod_dav_svn, etc.):

libsvn_client

Primary interface for client programs

libsvn_delta

Tree and byte-stream differencing routines

libsvn_diff

Contextual differencing and merging routines

libsvn_fs

Filesystem commons and module loader

libsvn_fs_base

The Berkeley DB filesystem backend

libsvn_fs_fs

The native filesystem (FSFS) backend

libsvn_ra

Repository Access commons and module loader

libsvn_ra_local

The local Repository Access module

libsvn_ra_neon

The WebDAV Repository Access module

libsvn_ra_serf

Another (experimental) WebDAV Repository Access module

libsvn_ra_svn

The custom protocol Repository Access module

libsvn_repos

Repository interface

libsvn_subr

Miscellaneous helpful subroutines

libsvn_wc

The working copy management library

mod_authz_svn

Apache authorization module for Subversion repositories access via WebDAV

mod_dav_svn

Apache module for mapping WebDAV operations to Subversion ones

The fact that the word miscellaneous appears only once in the previous list is a good sign. The Subversion development team is serious about making sure that functionality lives in the right layer and libraries. Perhaps the greatest advantage of the modular design is its lack of complexity from a developer’s point of view. As a developer, you can quickly formulate that kind of big picture that allows you to pinpoint the location of certain pieces of functionality with relative ease.

Another benefit of modularity is the ability to replace a given module with a whole new library that implements the same API without affecting the rest of the code base. In some sense, this happens within Subversion already. The libsvn_ra_local, libsvn_ra_n e on, libsvn_ra_serf, and libsvn_ra_svn libraries each implement the same interface, all working as plug-ins to libsvn_ra. And all four communicate with the Repository layer—libsvn_ra_local connects to the repository directly, whereas the other three do so over a network. The libsvn_fs_base and libsvn_fs_fs libraries are another pair of libraries that implement the same functionality in different ways—both are plug-ins to the common libsvn_fs library.

The client itself also highlights the benefits of modularity in the Subversion design. Subversion’s libsvn_client library is a one-stop shop for most of the functionality necessary for designing a working Subversion client (see Client Layer). So while the Subversion distribution provides only the svn command-line client program, several third-party programs provide various forms of graphical client UIs. These GUIs use the same APIs that the stock command-line client does. This type of modularity has played a large role in the proliferation of available Subversion clients and IDE integrations and, by extension, to the tremendous adoption rate of Subversion itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset