|
| static int | file_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) |
| | Read a single sub-tile payload from an on-disk .meta archive file.
|
| static struct stat_info | file_tile_stat (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z) |
| | Retrieve filesystem metadata and expiry status for the metatile containing (x, y, z).
|
| static char * | file_tile_storage_id (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, char *string) |
| | Format a human-readable file:// storage URI identifying the metatile for (x, y, z).
|
| static int | file_metatile_write (struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz) |
| | Atomically write a serialized metatile buffer to disk via a thread-specific temporary file.
|
| static int | file_metatile_delete (struct storage_backend *store, const char *xmlconfig, int x, int y, int z) |
| | Delete the on-disk .meta file containing (x, y, z).
|
| static int | file_metatile_expire (struct storage_backend *store, const char *xmlconfig, int x, int y, int z) |
| | Mark an on-disk .meta file as expired by backdating its modification timestamp (mtime).
|
| static int | file_close_storage (struct storage_backend *store) |
| | Release resources associated with a filesystem storage_backend instance.
|
| struct storage_backend * | init_storage_file (const char *tile_dir) |
| | Allocate and initialize a local filesystem metatile storage_backend.
|
| int file_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 |
Read a single sub-tile payload from an on-disk .meta archive file.
Resolves (xmlconfig, options, x, y, z) to a .meta path and sub-tile slot index, reads and validates the meta_layout header and magic bytes (META_MAGIC or META_MAGIC_COMPRESSED), seeks to the sub-tile's offset, and reads its payload into buf.
- Parameters
-
| store | Initialized file storage_backend (storage_ctx holds base tile directory). |
| xmlconfig | Logical map style name (e.g., "default"). |
| options | Style parameterization options string (empty if unused). |
| x | Tile X coordinate. |
| y | Tile Y coordinate. |
| z | Tile zoom level. |
| buf | Caller-supplied output buffer receiving the tile image bytes. |
| sz | Maximum capacity of buf in bytes. |
| compressed | Output flag set to 1 if the metatile uses META_MAGIC_COMPRESSED, 0 otherwise. |
| log_msg | Caller-supplied buffer (PATH_MAX bytes) populated with an error description on failure. |
- Returns
- Number of tile bytes read into buf (>= 0) on success, or a negative error code:
- -1: Header allocation failure or .meta file could not be opened.
- -2: read() error while reading the metatile header.
- -3: File truncated / smaller than header_len.
- -4: Invalid header magic bytes.
- -5: Unexpected tile count (m->count != METATILE * METATILE).
- -6: Stored tile size exceeds output buffer capacity sz.
- -7: lseek() failure seeking to sub-tile payload offset.
- -8: read() error while reading sub-tile payload data.
Allocate and initialize a local filesystem metatile storage_backend.
Duplicates tile_dir into store->storage_ctx and wires all backend operation function pointers (tile_read, tile_stat, metatile_write, metatile_delete, metatile_expire, tile_storage_id, and close_storage).
- Parameters
-
| tile_dir | Base directory path under which <xmlname>/<z>/.../<x>/<y>.meta files are stored. |
- Returns
- Newly allocated struct storage_backend pointer, or NULL on allocation failure.