diff options
author | Florin Coras <fcoras@cisco.com> | 2022-02-07 16:24:43 -0800 |
---|---|---|
committer | Florin Coras <fcoras@cisco.com> | 2022-02-08 16:44:06 -0800 |
commit | 023521fcb6713e1151a04e4358bb58695dd6e479 (patch) | |
tree | b225ec176e85301ebb1e6b60f17055c0526a60ea /src/plugins/http_static/http_static.h | |
parent | 48bdf24ad2a1266f8c6bf4932b92d0165f370171 (diff) |
http_static: cleanup file handler and cache
Type: refactor
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I7aff3a02315f9f92039dd2e3af1cbd8312aec662
Diffstat (limited to 'src/plugins/http_static/http_static.h')
-rw-r--r-- | src/plugins/http_static/http_static.h | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/src/plugins/http_static/http_static.h b/src/plugins/http_static/http_static.h index d3fa29b068d..c754337e303 100644 --- a/src/plugins/http_static/http_static.h +++ b/src/plugins/http_static/http_static.h @@ -21,7 +21,7 @@ #include <vppinfra/hash.h> #include <vppinfra/error.h> -#include <vppinfra/bihash_vec8_8.h> +#include <http_static/http_cache.h> /** @file http_static.h * Static http server definitions @@ -43,7 +43,7 @@ typedef struct /** Data to send */ u8 *data; /** Data length */ - u32 data_len; + u64 data_len; /** Current data send offset */ u32 data_offset; /** Need to free data in detach_cache_entry */ @@ -67,22 +67,6 @@ typedef struct hss_session_handle_ STATIC_ASSERT_SIZEOF (hss_session_handle_t, sizeof (u64)); -/** \brief In-memory file data cache entry - */ -typedef struct -{ - /** Name of the file */ - u8 *filename; - /** Contents of the file, as a u8 * vector */ - u8 *data; - /** Last time the cache entry was used */ - f64 last_used; - /** Cache LRU links */ - u32 next_index; - u32 prev_index; - /** Reference count, so we don't recycle while referenced */ - int inuse; -} hss_cache_entry_t; typedef struct hss_url_handler_args_ { @@ -125,28 +109,12 @@ typedef struct { /** Per thread vector of session pools */ hss_session_t **sessions; - /** Session pool reader writer lock */ - clib_spinlock_t cache_lock; - - /** Unified file data cache pool */ - hss_cache_entry_t *cache_pool; - /** Hash table which maps file name to file data */ - BVT (clib_bihash) name_to_data; /** Hash tables for built-in GET and POST handlers */ uword *get_url_handlers; uword *post_url_handlers; - /** Current cache size */ - u64 cache_size; - /** Max cache size in bytes */ - u64 cache_limit; - /** Number of cache evictions */ - u64 cache_evictions; - - /** Cache LRU listheads */ - u32 first_index; - u32 last_index; + hss_cache_t cache; /** root path to be served */ u8 *www_root; @@ -180,6 +148,8 @@ typedef struct u32 use_ptr_thresh; /** Enable the use of builtinurls */ u8 enable_url_handlers; + /** Max cache size before LRU occurs */ + u64 cache_size; } hss_main_t; extern hss_main_t hss_main; |