NetSurf
no_backing_store.c
Go to the documentation of this file.
1/*
2 * Copyright 2014 Vincent Sanders <vince@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/** \file
20 * Low-level resource cache null persistant storage implementation.
21 */
22
23#include "utils/nsurl.h"
24
26
27
28/* default to disabled backing store */
29static nserror initialise(const struct llcache_store_parameters *parameters)
30{
31 return NSERROR_OK;
32}
33
34static nserror finalise(void)
35{
36 return NSERROR_OK;
37}
38
39static nserror store(nsurl *url,
40 enum backing_store_flags flags,
41 uint8_t *data,
42 const size_t datalen)
43{
45}
46
47static nserror fetch(nsurl *url,
48 enum backing_store_flags flags,
49 uint8_t **data_out,
50 size_t *datalen_out)
51{
52 return NSERROR_NOT_FOUND;
53}
54
56{
57 return NSERROR_NOT_FOUND;
58}
59
60/**
61 * release a previously fetched or stored memory object.
62 *
63 * if the BACKING_STORE_ALLOC flag was used with the fetch or
64 * store operation for this url the returned storage is
65 * unreferenced. When the reference count drops to zero the
66 * storage is released.
67 *
68 * @param url The url is used as the unique primary key to invalidate.
69 * @param[in] flags The flags to control how the object data is released.
70 * @return NSERROR_OK on success or error code on faliure.
71 */
72static nserror release(nsurl *url, enum backing_store_flags flags)
73{
74 return NSERROR_NOT_FOUND;
75}
76
79 .finalise = finalise,
80 .store = store,
81 .fetch = fetch,
82 .invalidate = invalidate,
83 .release = release,
84};
85
Low-level source data cache backing store interface.
backing_store_flags
storage control flags
Definition: backing_store.h:30
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_SAVE_FAILED
Failed to save data.
Definition: errors.h:36
@ NSERROR_NOT_FOUND
Requested item not found.
Definition: errors.h:34
@ NSERROR_OK
No error.
Definition: errors.h:30
static nserror initialise(const struct llcache_store_parameters *parameters)
static nserror store(nsurl *url, enum backing_store_flags flags, uint8_t *data, const size_t datalen)
static nserror finalise(void)
struct gui_llcache_table * null_llcache_table
static nserror release(nsurl *url, enum backing_store_flags flags)
release a previously fetched or stored memory object.
static struct gui_llcache_table llcache_table
static nserror invalidate(nsurl *url)
static nserror fetch(nsurl *url, enum backing_store_flags flags, uint8_t **data_out, size_t *datalen_out)
NetSurf URL handling (interface).
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
low level cache backing store operation table
Definition: backing_store.h:44
nserror(* initialise)(const struct llcache_store_parameters *parameters)
Initialise the backing store.
Definition: backing_store.h:51
Parameters to configure the low level cache backing store.
Definition: llcache.h:119