mirror of
https://github.com/openstreetmap/mod_tile.git
synced 2025-08-08 08:24:25 +00:00

* Using [`GLib Logging Framework`](https://developer.gnome.org/programming-guidelines/stable/logging.html.en) for logging * Created new `g_logger` function for logging * Outputs to `stdout`/`stderr` only when running in `foreground` * `stderr` for `message`, `warning`, `critical` & `error` levels * `stdout` for `debug` & `info` levels * Use `G_MESSAGES_DEBUG=all` environment to enable `debug` to print * Otherwise, output will be to `syslog` or `systemd journal` (when appropriate) * Standardized usage of `{LOG_PRIORITY}: ` prefix in log messages * Only when using `syslog`, otherwise `GLib Logging` will take care of it * Changed `fprintf(stderr`, `printf` & `perror` calls to `g_logger` calls * You might want to check them out closely to make sure I chose the right levels * No changes to `logging/output` were made to "`foreground`" programs (I.E. `render_*`) * Changed `0`,`1` to `no_argument`,`required_argument` in `getopt_long`'s `long_options` * Fixed `renderd`'s `foreground` opt (should be `no_argument` [0] rather than `reguired_argument` [1]) * Basic test for `mod_tile` module * ~~Extended `renderd` log priority onto Mapnik's logger~~
55 lines
2.1 KiB
C
55 lines
2.1 KiB
C
/*
|
|
* Copyright (c) 2007 - 2020 by mod_tile contributors (see AUTHORS file)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; If not, see http://www.gnu.org/licenses/.
|
|
*/
|
|
|
|
#ifndef STORE_H
|
|
#define STORE_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include "render_config.h"
|
|
|
|
struct stat_info {
|
|
off_t size; /* total size, in bytes */
|
|
time_t atime; /* time of last access */
|
|
time_t mtime; /* time of last modification */
|
|
time_t ctime; /* time of last status change */
|
|
int expired; /* has the tile expired */
|
|
};
|
|
|
|
struct storage_backend {
|
|
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);
|
|
struct stat_info(*tile_stat)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z);
|
|
int (*metatile_write)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, const char *buf, int sz);
|
|
int (*metatile_delete)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
|
|
int (*metatile_expire)(struct storage_backend * store, const char *xmlconfig, int x, int y, int z);
|
|
char * (*tile_storage_id)(struct storage_backend * store, const char *xmlconfig, const char *options, int x, int y, int z, char * string);
|
|
int (*close_storage)(struct storage_backend * store);
|
|
|
|
void * storage_ctx;
|
|
};
|
|
|
|
struct storage_backend * init_storage_backend(const char * options);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|