Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_disk_cache.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include "nilorea/n_disk_cache.h"
#include <utime.h>
Include dependency graph for ex_disk_cache.c:

Go to the source code of this file.

Macros

#define EX_DIR   "ex_disk_cache.dir"
 the scratch directory, made and removed by this example
#define ex_mkdir(p)
 owner only elsewhere

Functions

static int exists (const char *path)
 does a file exist
static void expect_true (const char *what, int ok)
 record one check
static int has (const N_DISK_CACHE *cache, const char *key)
 is the entry for key there
int main (int argc, char **argv)
static int process_args (int argc, char **argv)
 read -V LOGLEVEL
static void put_aged (const N_DISK_CACHE *cache, const char *key, long ago)
 store 100 bytes under key and say it was last used ago seconds ago
static void write_foreign (const char *name)
 write a small file that is not an entry

Variables

static int failures = 0
static int log_level = 3

Macro Definition Documentation

◆ EX_DIR

#define EX_DIR   "ex_disk_cache.dir"

the scratch directory, made and removed by this example

Examples
ex_disk_cache.c.

Definition at line 38 of file ex_disk_cache.c.

Referenced by main(), and write_foreign().

◆ ex_mkdir

#define ex_mkdir ( p)
Value:
mkdir(p, 0700)

owner only elsewhere

Examples
ex_disk_cache.c.

Definition at line 34 of file ex_disk_cache.c.

Referenced by main().

Function Documentation

◆ exists()

int exists ( const char * path)
static

does a file exist

Examples
ex_disk_cache.c.

Definition at line 68 of file ex_disk_cache.c.

Referenced by has(), and main().

Here is the caller graph for this function:

◆ expect_true()

void expect_true ( const char * what,
int ok )
static

record one check

Definition at line 44 of file ex_disk_cache.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ has()

int has ( const N_DISK_CACHE * cache,
const char * key )
static

is the entry for key there

Examples
ex_disk_cache.c.

Definition at line 102 of file ex_disk_cache.c.

References exists(), key, and n_disk_cache_path().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

◆ process_args()

int process_args ( int argc,
char ** argv )
static

read -V LOGLEVEL

Definition at line 54 of file ex_disk_cache.c.

References log_level.

◆ put_aged()

void put_aged ( const N_DISK_CACHE * cache,
const char * key,
long ago )
static

store 100 bytes under key and say it was last used ago seconds ago

Examples
ex_disk_cache.c.

Definition at line 88 of file ex_disk_cache.c.

References key, n_disk_cache_path(), and n_disk_cache_put().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_foreign()

void write_foreign ( const char * name)
static

write a small file that is not an entry

Examples
ex_disk_cache.c.

Definition at line 75 of file ex_disk_cache.c.

References EX_DIR.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Definition at line 41 of file ex_disk_cache.c.

◆ log_level

int log_level = 3
static
Examples
ex_accept_pool_client.c, ex_accept_pool_server.c, ex_allegro_4.c, ex_clock_sync.c, ex_common.c, ex_crypto.c, ex_disk_cache.c, ex_file.c, ex_fluid.c, ex_git.c, ex_gui.c, ex_gui_bench.c, ex_gui_button_keys.c, ex_gui_checkbox_label.c, ex_gui_color_picker.c, ex_gui_colorwheel.c, ex_gui_combobox_items.c, ex_gui_curve.c, ex_gui_custom.c, ex_gui_custom_mouse.c, ex_gui_datagrid.c, ex_gui_detach.c, ex_gui_dictionary.c, ex_gui_display_fallback.c, ex_gui_dropmenu.c, ex_gui_global_scroll.c, ex_gui_grid.c, ex_gui_hexview.c, ex_gui_hover.c, ex_gui_kvtable.c, ex_gui_label_fits.c, ex_gui_label_lines.c, ex_gui_multiwin.c, ex_gui_network.c, ex_gui_particles.c, ex_gui_placeholder.c, ex_gui_popup.c, ex_gui_progressbar.c, ex_gui_reentrant.c, ex_gui_round.c, ex_gui_sectionlist.c, ex_gui_splitpane.c, ex_gui_syntaxview.c, ex_gui_text_shorten.c, ex_gui_textarea_selection.c, ex_gui_tooltip.c, ex_gui_tree_lazy.c, ex_gui_window_rect.c, ex_gui_zorder.c, ex_json.c, ex_kafka.c, ex_module.c, ex_network.c, ex_network_mock.c, ex_network_proxy.c, ex_network_reactor.c, ex_network_sse.c, ex_network_ssl.c, ex_network_ssl_hardened.c, ex_network_ws.c, ex_pth.c, ex_sha256.c, ex_stack.c, ex_threads.c, ex_tiff.c, ex_trees.c, and ex_zip.c.

Definition at line 40 of file ex_disk_cache.c.

Referenced by _n_log(), main(), main(), parse_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), process_args(), and set_log_level().