mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
Loading...
Searching...
No Matches
store.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 - 2026 by mod_tile contributors (see AUTHORS file)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; If not, see http://www.gnu.org/licenses/.
16 */
17
18#ifndef STORE_H
19#define STORE_H
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include "render_config.h"
26#include <stdlib.h>
27#include <sys/types.h>
28
32 struct stat_info {
34 off_t size;
36 time_t atime;
38 time_t mtime;
40 time_t ctime;
43 };
44
50 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 *err_msg);
52 struct stat_info (*tile_stat)(struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z);
54 int (*metatile_write)(struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz);
56 int (*metatile_delete)(struct storage_backend *store, const char *xmlconfig, int x, int y, int z);
58 int (*metatile_expire)(struct storage_backend *store, const char *xmlconfig, int x, int y, int z);
60 char *(*tile_storage_id)(struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, char *string);
62 int (*close_storage)(struct storage_backend *store);
63
66 };
67
68 struct storage_backend *init_storage_backend(const char *options);
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif /* STORE_H */
struct storage_backend * init_storage_backend(const char *options)
Instantiate and initialize a storage backend from a path or URI specification.
Definition store.c:56
Metadata and expiry state returned when querying a stored tile or metatile.
Definition store.h:32
time_t ctime
Timestamp of last status change (seconds since Unix epoch).
Definition store.h:40
time_t mtime
Timestamp of last tile modification/render (seconds since Unix epoch).
Definition store.h:38
off_t size
Total tile payload size in bytes (< 0 indicates the tile does not exist).
Definition store.h:34
int expired
Non-zero if the tile is marked expired and needs re-rendering; 0 if fresh.
Definition store.h:42
time_t atime
Timestamp of last tile access (seconds since Unix epoch).
Definition store.h:36
Virtual dispatch table and context handle for a pluggable tile/metatile storage backend.
Definition store.h:48
int(*) metatile_write(struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz)
Persist a serialized METATILE x METATILE archive buffer into the backend.
Definition store.h:54
int(*) metatile_delete(struct storage_backend *store, const char *xmlconfig, int x, int y, int z)
Remove the metatile containing coordinates (x, y, z) from the backend.
Definition store.h:56
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 *err_msg)
Read a single tile's payload into buf, returning bytes read or < 0 on error.
Definition store.h:50
int(*) metatile_expire(struct storage_backend *store, const char *xmlconfig, int x, int y, int z)
Mark the metatile containing coordinates (x, y, z) as expired.
Definition store.h:58
void * storage_ctx
Opaque pointer to backend-specific private state/configuration context.
Definition store.h:65
int(*) close_storage(struct storage_backend *store)
Release backend-specific resources and free the storage_backend instance.
Definition store.h:62
struct stat_info(*) tile_stat(struct storage_backend *store, const char *xmlconfig, const char *options, int x, int y, int z)
Query size, timestamps, and expiry status of a tile without reading its full payload.
Definition store.h:52