mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
Loading...
Searching...
No Matches
store_null.c File Reference
#include <glib.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "g_logger.h"
#include "store.h"
#include "store_null.h"

Functions

static int tile_read (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, char *buf, size_t sz, int *compressed, char *log_msg)
 Simulate a failed tile read from the no-op null storage backend.
static struct stat_info tile_stat (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z)
 Return metadata indicating that the requested tile does not exist and is expired.
static int metatile_write (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz)
 Discard a serialized metatile buffer while reporting a successful write.
static int metatile_delete (struct storage_backend *store, const char *xmlconfig, int x, int y, int z)
 No-op metatile deletion handler for the null storage backend.
static int metatile_expire (struct storage_backend *store, const char *xmlconfig, int x, int y, int z)
 No-op metatile expiry handler for the null storage backend.
static char * tile_storage_id (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, char *string)
 Format the static "null://" storage identifier URI.
static int close_storage (struct storage_backend *store)
 Close the null storage backend (no resources to release).
struct storage_backend * init_storage_null ()
 Allocate and initialize a no-op null storage_backend.

Function Documentation

◆ close_storage()

int close_storage ( struct storage_backend * store)
static

Close the null storage backend (no resources to release).

Parameters
storeNull storage_backend instance (unused).
Returns
Always returns 0.

◆ init_storage_null()

struct storage_backend * init_storage_null ( )

Allocate and initialize a no-op null storage_backend.

Sets storage_ctx to NULL and wires all backend operation function pointers to the no-op handlers defined in this file.

Returns
Newly allocated struct storage_backend pointer, or NULL on allocation failure.

◆ metatile_delete()

int metatile_delete ( struct storage_backend * store,
const char * xmlconfig,
int x,
int y,
int z )
static

No-op metatile deletion handler for the null storage backend.

Parameters
storeNull storage_backend instance (unused).
xmlconfigLogical map style name (unused).
xTile X coordinate (unused).
yTile Y coordinate (unused).
zTile zoom level (unused).
Returns
Always returns 0.

◆ metatile_expire()

int metatile_expire ( struct storage_backend * store,
const char * xmlconfig,
int x,
int y,
int z )
static

No-op metatile expiry handler for the null storage backend.

Parameters
storeNull storage_backend instance (unused).
xmlconfigLogical map style name (unused).
xTile X coordinate (unused).
yTile Y coordinate (unused).
zTile zoom level (unused).
Returns
Always returns 0.

◆ metatile_write()

int metatile_write ( struct storage_backend * store,
const char * xmlconfig,
const char * options,
int x,
int y,
int z,
const char * buf,
int sz )
static

Discard a serialized metatile buffer while reporting a successful write.

Parameters
storeNull storage_backend instance (unused).
xmlconfigLogical map style name (unused).
optionsStyle parameterization options string (unused).
xTop-left tile X coordinate of the metatile (unused).
yTop-left tile Y coordinate of the metatile (unused).
zTile zoom level (unused).
bufSerialized metatile buffer (ignored).
szByte length of buf.
Returns
Always returns sz to simulate a complete write.

◆ tile_read()

int tile_read ( struct storage_backend * store,
const char * xmlconfig,
const char * options,
int x,
int y,
int z,
char * buf,
size_t sz,
int * compressed,
char * log_msg )
static

Simulate a failed tile read from the no-op null storage backend.

Always writes "Cannot read from NULL storage." into log_msg and returns -1.

Parameters
storeNull storage_backend instance (unused).
xmlconfigLogical map style name (unused).
optionsStyle parameterization options string (unused).
xTile X coordinate (unused).
yTile Y coordinate (unused).
zTile zoom level (unused).
bufOutput buffer (untouched).
szCapacity of buf in bytes (unused).
compressedCompression flag output pointer (untouched).
log_msgCaller-supplied buffer receiving an error message on failure.
Returns
Always returns -1 (cache miss / unreadable).

◆ tile_stat()

struct stat_info tile_stat ( struct storage_backend * store,
const char * xmlconfig,
const char * options,
int x,
int y,
int z )
static

Return metadata indicating that the requested tile does not exist and is expired.

Parameters
storeNull storage_backend instance (unused).
xmlconfigLogical map style name (unused).
optionsStyle parameterization options string (unused).
xTile X coordinate (unused).
yTile Y coordinate (unused).
zTile zoom level (unused).
Returns
struct stat_info with size = -1, zeroed timestamps, and expired = 1.

◆ tile_storage_id()

char * tile_storage_id ( struct storage_backend * store,
const char * xmlconfig,
const char * options,
int x,
int y,
int z,
char * string )
static

Format the static "null://" storage identifier URI.

Parameters
storeNull storage_backend instance (unused).
xmlconfigLogical map style name (unused).
optionsStyle parameterization options string (unused).
xTile X coordinate (unused).
yTile Y coordinate (unused).
zTile zoom level (unused).
stringCaller-supplied output buffer (PATH_MAX bytes) receiving "null://".
Returns
Pointer to string.