1/*
2 * arenax_cold.c
3 *
4 * Copyright (C) 2014 Aerospike, Inc.
5 *
6 * Portions may be licensed to Aerospike, Inc. under one or more contributor
7 * license agreements.
8 *
9 * This program is free software: you can redistribute it and/or modify it under
10 * the terms of the GNU Affero General Public License as published by the Free
11 * Software Foundation, either version 3 of the License, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see http://www.gnu.org/licenses/
21 */
22
23//==========================================================
24// Includes.
25//
26
27#include "arenax.h"
28
29#include <stdbool.h>
30#include <stdint.h>
31#include "citrusleaf/alloc.h"
32#include "fault.h"
33
34
35//==========================================================
36// Public API.
37//
38
39bool
40cf_arenax_want_prefetch(cf_arenax* arena)
41{
42 return false;
43}
44
45void
46cf_arenax_reclaim(cf_arenax* arena, cf_arenax_puddle* puddles,
47 uint32_t n_puddles)
48{
49}
50
51
52//==========================================================
53// Private API - for enterprise separation only.
54//
55
56// Allocate an arena stage, and store its pointer in the stages array.
57cf_arenax_err
58cf_arenax_add_stage(cf_arenax* arena)
59{
60 if (arena->stage_count >= arena->max_stages) {
61 cf_ticker_warning(CF_ARENAX, "can't allocate more than %u arena stages",
62 arena->max_stages);
63 return CF_ARENAX_ERR_STAGE_CREATE;
64 }
65
66 uint8_t* p_stage = (uint8_t*)cf_try_malloc(arena->stage_size);
67
68 if (! p_stage) {
69 cf_ticker_warning(CF_ARENAX,
70 "could not allocate %zu-byte arena stage %u",
71 arena->stage_size, arena->stage_count);
72 return CF_ARENAX_ERR_STAGE_CREATE;
73 }
74
75 arena->stages[arena->stage_count++] = p_stage;
76
77 return CF_ARENAX_OK;
78}
79
80cf_arenax_handle
81cf_arenax_alloc_chunked(cf_arenax* arena, cf_arenax_puddle* puddle)
82{
83 cf_crash(AS_INDEX, "CE code called cf_arenax_alloc_chunked()");
84 return 0;
85}
86
87void
88cf_arenax_free_chunked(cf_arenax* arena, cf_arenax_handle h,
89 cf_arenax_puddle* puddle)
90{
91 cf_crash(AS_INDEX, "CE code called cf_arenax_free_chunked()");
92}
93