Index of /~chrisd/projects/shared_map

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[DIR]deprecated/2016-01-27 20:45 -  
[TXT]mod_shmap.c2009-05-13 20:35 29K 
[TXT]mod_slotmem_zk.c2009-05-13 20:35 8.2K 
[TXT]mod_socache_zk.c2009-05-13 04:03 8.1K 

Note: The mod_shmap module provides a simple HTTP interface to the "slotmem" (fixed-length record) and "socache" (small object cache) data storage providers available in httpd trunk circa r773977.

Note: The mod_socache_zookeeper module is deprecated; use mod_zk and mod_socache_zk instead.

Clients access data using GET, PUT, and DELETE methods. When using a slotmem provider, the final component of the URI must be a numeric record index. For example (using the sample configurations shown below):

    PUT /mem/123 HTTP/1.0
    Content-Length: 5


    PUT /map/abc/def HTTP/1.0
    Content-Length: 5


    GET /mem/123 HTTP/1.0

    ==> hello

    GET /map/abc/def HTTP/1.0

    ==> world

    DELETE /mem/123 HTTP/1.0
    DELETE /map/abc/def HTTP/1.0
Any portion of the URI namespace may be assigned for use with mod_shmap by enabling the module's handler and specifying the data storage provider to be used. For example:
    LoadModule shmap_module       modules/
    LoadModule sharedmem_module   modules/
    LoadModule socache_dbm_module modules/

    <Location /mem>
        SetHandler shmap-handler
        SharedMapProvider slotmem:shared :shmap(1024:500:p) /mem

    <Location /map>
        SetHandler shmap-handler
        SharedMapProvider socache:dbm /path/to/dbm/file.db /map
The first parameter of the SharedMapProvider directive specifies the type and name of the provider, e.g., socache:dbm for the mod_socache_dbm module and slotmem:shared for the mod_sharedmem module. Note that the provider module must also be loaded with the LoadModule directive in order for it to be available to mod_shmap.

The second parameter defines the particular data store to be used by the provider. For socache providers, this parameter's format is specific to the provider.

For slotmem providers, the parameter should be of the form [name][([item_size][:[item_num][:p]])] where the arguments correspond to those passed to the provider's slotmem_create() method. All arguments are optional and if not defined, default values will be used. The :p flag argument may be defined to specify persistence between invocations of the httpd server.

The third parameter, if present, defines a URI path which must match the leading portion of the URI in each HTTP request, and which will be removed before the remainder of the URI is used to index the provider's data store.

Note: The mod_slotmem_zk and mod_socache_zk modules are slotmem and socache API providers, respectively, which utilize the mod_zk module to access an Apache ZooKeeper cluster for their data storage. The mod_zk module is included in my zookeeper projects.

The zookeeper_mt multi-threaded ZooKeeper C client library is required when compiling, along with the mod_zk.h C header file; for example:

    apxs -c -I/path/to/mod_zk/include -I/path/to/zk/include \
        -L/path/to/zk/lib -lzookeeper_mt mod_socache_zk.c
ZooKeeper clusters are identified by their mod_zk alias in the string arguments passed to the slotmem_create() and socache create() methods. The following example demonstrates usage of both modules in combination with mod_zk and mod_shmap:
    LoadModule shmap_module       modules/
    LoadModule zk_module          modules/
    LoadModule slotmem_zk_module  modules/
    LoadModule socache_zk_module  modules/

    SetHandler shmap-handler

    ZKCluster zk1 host1:7000,host2:7000,host3:9000

    <Location /zk/mem>
        SharedMapProvider slotmem:zookeeper zk1 /zk/mem

    <Location /zk/map>
        SharedMapProvider socache:zookeeper zk1 /zk/map