|
mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
|
Go to the source code of this file.
Classes | |
| struct | stats_struct |
| Cumulative render request counts and elapsed render durations tracked by request_queue. More... | |
| struct | item_idx |
| Hash bucket chain node mapping a metatile hash key to an active or queued struct item. More... | |
| struct | request_queue |
| Thread-safe multi-priority metatile render queue with hash-based duplicate coalescing. More... | |
Macros | |
| #define | HASHIDX_SIZE 2213 |
| Prime bucket count for the hash table indexing queued and in-flight metatile render requests. | |
Functions | |
| struct request_queue * | request_queue_init () |
| Allocate and initialize a new request_queue with empty circular queues and hash index. | |
| void | request_queue_close (struct request_queue *queue) |
| Destroy the request queue mutex and free the hash index and queue structure. | |
| struct item * | request_queue_fetch_request (struct request_queue *queue) |
| Pop the highest-priority pending request from queue and move it to the active render list. | |
| enum protoCmd | request_queue_add_request (struct request_queue *queue, struct item *request) |
| Enqueue a new tile render request or coalesce it with an existing pending item. | |
| void | request_queue_remove_request (struct request_queue *queue, struct item *request, int render_time) |
| Unlink a completed request from the active render list, remove it from the hash index, and record render timing statistics. | |
| void | request_queue_clear_requests_by_fd (struct request_queue *queue, int fd) |
| Invalidate all queued/rendering references to a disconnected client socket fd. | |
| int | request_queue_no_requests_queued (struct request_queue *queue, enum protoCmd) |
| Query the current number of pending items in a specific priority sub-queue. | |
| void | request_queue_copy_stats (struct request_queue *queue, stats_struct *stats) |
| Copy a thread-safe snapshot of the queue's cumulative render statistics. | |
| #define HASHIDX_SIZE 2213 |
Prime bucket count for the hash table indexing queued and in-flight metatile render requests.
| enum protoCmd request_queue_add_request | ( | struct request_queue * | queue, |
| struct item * | item ) |
Enqueue a new tile render request or coalesce it with an existing pending item.
Deduplicates item via pending(). If unique, places item onto the queue matching item->req.cmd (reqHead, reqPrioHead, reqLowHead, or reqBulkHead) when below REQ_LIMIT, or falls back to dirtyHead (with fd = FD_INVALID) when below DIRTY_LIMIT. Drops and frees item if both limits are saturated.
| queue | Request queue instance (must not be NULL). |
| item | Heap-allocated request item (ownership transferred to queue or freed on drop). |
| void request_queue_clear_requests_by_fd | ( | struct request_queue * | queue, |
| int | fd ) |
Invalidate all queued/rendering references to a disconnected client socket fd.
Walks the interactive and active render queues (reqHead, renderHead, reqPrioHead, reqBulkHead, reqLowHead) plus any attached duplicates chains, setting matching fd fields to FD_INVALID so worker threads do not attempt to write responses to a closed or reused descriptor. (dirtyHead items already hold FD_INVALID.)
| queue | Request queue instance. |
| fd | Client socket file descriptor that was closed or errored. |
| void request_queue_close | ( | struct request_queue * | queue | ) |
Destroy the request queue mutex and free the hash index and queue structure.
| queue | Request queue instance to tear down. |
| void request_queue_copy_stats | ( | struct request_queue * | queue, |
| stats_struct * | stats ) |
Copy a thread-safe snapshot of the queue's cumulative render statistics.
| queue | Request queue instance. |
| stats | Destination stats_struct buffer populated under queue->qLock. |
| struct item * request_queue_fetch_request | ( | struct request_queue * | queue | ) |
Pop the highest-priority pending request from queue and move it to the active render list.
Blocks on queue->qCond until at least one pending queue is non-empty. Dequeues in strict priority order:
Moves the selected item onto renderHead with inQueue = queueRender while keeping it registered in the hash index so incoming duplicate requests still coalesce with it.
| queue | Request queue instance. |
| struct request_queue * request_queue_init | ( | ) |
Allocate and initialize a new request_queue with empty circular queues and hash index.
Initializes qLock, qCond, all six circular doubly-linked list sentinel heads (reqHead, reqPrioHead, reqLowHead, reqBulkHead, dirtyHead, renderHead), zeroed statistics counters, and the HASHIDX_SIZE-bucket hash table.
| int request_queue_no_requests_queued | ( | struct request_queue * | queue, |
| enum protoCmd | priority ) |
Query the current number of pending items in a specific priority sub-queue.
| queue | Request queue instance. |
| priority | Command enum identifying the sub-queue (cmdRenderPrio, cmdRender, cmdRenderLow, cmdDirty, or cmdRenderBulk). |
| void request_queue_remove_request | ( | struct request_queue * | queue, |
| struct item * | request, | ||
| int | render_time ) |
Unlink a completed request from the active render list, remove it from the hash index, and record render timing statistics.
Does not free request itself (the caller frees request and any chained duplicates after sending responses).
| queue | Request queue instance. |
| request | Completed request item currently on renderHead. |
| render_time | Elapsed render duration in milliseconds (recorded if > 0). |