~mil/mepo

3ef5c174dc640f4f5b3653f5883ea8fc927e9588 — Miles Alan 2 years ago 53d42e5 queueing-3-threads
Rename Lifo to QueueHashMap
2 files changed, 7 insertions(+), 7 deletions(-)

M src/TileCache.zig
M src/datastructure/datastructure.zig
M src/TileCache.zig => src/TileCache.zig +6 -6
@@ 53,11 53,11 @@ cache_dir: ?std.fs.Dir,
curl_multi: *curl.CURLM,
max_n_transfers: usize = 20,
mutex: std.Thread.Mutex,
queue_lifo: datastructure.Lifo(types.XYZ, bool),
queue_lifo: datastructure.QueueHashMap(types.XYZ, bool),
renderer: ?*sdl.SDL_Renderer,
source_url: ?[:0]const u8,
texture_map: datastructure.Lifo(types.XYZ, *sdl.SDL_Texture),
transfer_map: datastructure.Lifo(types.XYZ, *TransferDatum),
texture_map: datastructure.QueueHashMap(types.XYZ, *sdl.SDL_Texture),
transfer_map: datastructure.QueueHashMap(types.XYZ, *TransferDatum),

/// Retreives a tile from cache
/// If tile is not present & will queue tile to be downloaded if downloading


@@ 486,11 486,11 @@ pub fn init(allocator: *std.mem.Allocator) anyerror!@This() {
            .curl_multi = curl.curl_multi_init().?,
            .thread_download = null,
            .mutex = std.Thread.Mutex{},
            .queue_lifo = datastructure.Lifo(types.XYZ, bool).init(allocator),
            .queue_lifo = datastructure.QueueHashMap(types.XYZ, bool).init(allocator),
            .renderer = null,
            .source_url = null,
            .texture_map = datastructure.Lifo(types.XYZ, *sdl.SDL_Texture).init(allocator),
            .transfer_map = datastructure.Lifo(types.XYZ, *TransferDatum).init(allocator),
            .texture_map = datastructure.QueueHashMap(types.XYZ, *sdl.SDL_Texture).init(allocator),
            .transfer_map = datastructure.QueueHashMap(types.XYZ, *TransferDatum).init(allocator),
        });
    } else {
        return error.MultiInitFail;

M src/datastructure/datastructure.zig => src/datastructure/datastructure.zig +1 -1
@@ 1,6 1,6 @@
const std = @import("std");

pub fn Lifo(comptime key_type: type, comptime metadata_type: type) type {
pub fn QueueHashMap(comptime key_type: type, comptime metadata_type: type) type {
    return struct {
        array_hash_map: std.array_hash_map.AutoArrayHashMap(comptime key_type, comptime metadata_type),
        mutex: std.Thread.Mutex,