My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Macros | Functions | Variables
cache_msu.c File Reference
#include "connection-handler.h"
#include "dfg.h"
#include "local_msu.h"
#include "logging.h"
#include "msu_calls.h"
#include "msu_message.h"
#include "msu_type.h"
#include "routing_strategies.h"
#include "rt_stats.h"
#include "local_files.h"
#include "webserver/uthash.h"
#include "webserver/write_msu.h"
#include "webserver/cache_msu.h"
#include "webserver/fileio_msu.h"
#include "webserver/httpops.h"
#include <string.h>

Go to the source code of this file.

Classes

struct  cached_file
 
struct  ws_cache_state
 

Macros

#define DEFAULT_WWW_DIR   "www/"
 
#define DEFAULT_OCCUPANCY_RATE   0.2
 
#define DEFAULT_MAX_KB_SIZE   UINT_MAX
 
#define DEFAULT_MAX_FILES   UINT_MAX
 
#define CACHE_INIT_SYNTAX
 
#define MONITOR_CACHE_STATS
 
#define CACHE_HIT_STAT   MSU_STAT1
 
#define CACHE_MISS_STAT   MSU_STAT2
 
#define CACHE_EVICT_STAT   MSU_STAT3
 

Functions

struct cached_filecheck_cache (struct ws_cache_state *fc, char *path)
 
static int parse_init_cache_payload (char *to_parse, struct ws_cache_state *cache_state)
 
static int cache_file (struct ws_cache_state *fc, char *path, char *contents, long length)
 
static int ws_cache_lookup (struct local_msu *self, struct msu_msg *msg)
 
static int ws_cache_init (struct local_msu *self, struct msu_init_data *init_data)
 

Variables

static struct local_msucache_instance
 
struct msu_type WEBSERVER_CACHE_MSU_TYPE
 

Macro Definition Documentation

#define CACHE_EVICT_STAT   MSU_STAT3

Definition at line 50 of file cache_msu.c.

#define CACHE_HIT_STAT   MSU_STAT1

Definition at line 48 of file cache_msu.c.

#define CACHE_INIT_SYNTAX
Value:
"<www_dir>, <max_cache_size_in_kb>, <max_cached_files>, " \
"<max_cache_occupancy_rate>"

Definition at line 44 of file cache_msu.c.

#define CACHE_MISS_STAT   MSU_STAT2

Definition at line 49 of file cache_msu.c.

#define DEFAULT_MAX_FILES   UINT_MAX

Definition at line 43 of file cache_msu.c.

#define DEFAULT_MAX_KB_SIZE   UINT_MAX

Definition at line 42 of file cache_msu.c.

#define DEFAULT_OCCUPANCY_RATE   0.2

Definition at line 41 of file cache_msu.c.

#define DEFAULT_WWW_DIR   "www/"

Definition at line 40 of file cache_msu.c.

#define MONITOR_CACHE_STATS

Definition at line 47 of file cache_msu.c.

Function Documentation

static int cache_file ( struct ws_cache_state fc,
char *  path,
char *  contents,
long  length 
)
static

Definition at line 152 of file cache_msu.c.

struct cached_file* check_cache ( struct ws_cache_state fc,
char *  path 
)

Definition at line 76 of file cache_msu.c.

static int parse_init_cache_payload ( char *  to_parse,
struct ws_cache_state cache_state 
)
static

Definition at line 102 of file cache_msu.c.

static int ws_cache_init ( struct local_msu self,
struct msu_init_data init_data 
)
static

Definition at line 276 of file cache_msu.c.

static int ws_cache_lookup ( struct local_msu self,
struct msu_msg msg 
)
static

Definition at line 231 of file cache_msu.c.

Variable Documentation

struct local_msu* cache_instance
static

Definition at line 53 of file cache_msu.c.

struct msu_type WEBSERVER_CACHE_MSU_TYPE
Initial value:
= {
.name = "Webserver_cache_msu",
.receive = ws_cache_lookup,
.init = ws_cache_init,
}
int shortest_queue_route(struct msu_type *type, struct local_msu *sender, struct msu_msg *msg, struct msu_endpoint *output)
Chooses the local MSU with the shortest queue.
#define WEBSERVER_CACHE_MSU_TYPE_ID
Definition: cache_msu.h:23
static int ws_cache_init(struct local_msu *self, struct msu_init_data *init_data)
Definition: cache_msu.c:276
static int ws_cache_lookup(struct local_msu *self, struct msu_msg *msg)
Definition: cache_msu.c:231

Definition at line 300 of file cache_msu.c.