summaryrefslogtreecommitdiffstats
path: root/src/cache.h
blob: 9f333d398cfaf5ff7082c4bd87655fe9b1805c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* SPDX-License-Identifier: LGPL-2.1-only */

/* Copyright (C) 2020 Gediminas Jakutis */

#ifndef ALGOS_CACHE_H_INCLUDED
#define ALGOS_CACHE_H_INCLUDED

#include <stddef.h>
#include "defs.h"

/* INIT|DESTROY */
int cache_create(struct stream * const in, const struct settings * const restrict s);
int cache_populate(struct stream * const in);
int cache_flush(struct stream * const in);
int cache_destroy(struct stream * const in);

/* BLOCKMANIP */
int cache_transfer(struct stream * const src, struct stream * const dest);
int cache_block_copy(struct stream const * const src, struct stream * const dest, const struct settings * const s);
int cache_list_copy(struct stream const * const src, struct stream * const dest, const struct settings * const s);
int cache_block_split(struct stream * const src, struct stream * const A, struct stream * const B);
int cache_list_split(struct stream * const src, struct stream * const A, struct stream * const B);

/* GET */
struct entry_l *cached_get_array(struct stream * const in);
struct entry_l *cached_get_list(struct stream * const in);

/* PUT */
int cached_put_array(struct stream * const in, const struct entry_l * const data);
int cached_put_list(struct stream * const restrict in, const struct entry_l * const node);

#endif /* ALGOS_CACHE_H_INCLUDED */