This commit is contained in:
Hongze Cheng 2021-11-09 17:09:06 +08:00
parent a9fccb1b66
commit 140e2abc83
2 changed files with 64 additions and 5 deletions

View File

@ -55,25 +55,31 @@ struct SVnodeOptions {
/**
* @brief time to live of tables in this vnode
* in SECONDS
*
*
*/
uint32_t ttl;
/**
* @brief if time-series requests eventual consistency
*
*
*/
bool isWeak;
/**
* @brief if the allocator is heap allcator or arena allocator
*
*/
bool isHeapAllocator;
/**
* @brief TSDB options
*
*
*/
STsdbOptions tsdbOptions;
/**
* @brief META options
*
*
*/
SMetaOptions metaOptions;
// STqOptions tqOptions; // TODO

View File

@ -11,4 +11,57 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "vnodeDef.h"
/* ------------------------ Heap Allocator ------------------------ */
typedef struct {
uint64_t tsize;
uint64_t used;
} SVHeapAllocator;
SMemAllocator *vhaCreate(uint64_t size) {
SMemAllocator *pma;
pma = (SMemAllocator *)calloc(1, sizeof(*pma) + sizeof(SVHeapAllocator));
if (pma == NULL) {
return NULL;
}
pma->impl = POINTER_SHIFT(pma, sizeof(*pma));
/* TODO */
return NULL;
}
void vhaDestroy(SMemAllocator *pma) { /* TODO */
}
static void *vhaMalloc(SMemAllocator *pma, uint64_t size) {
SVHeapAllocator *pvha = (SVHeapAllocator *)(pma->impl);
/* TODO */
return NULL;
}
static void *vhaCalloc(SMemAllocator *pma, size_t nmemb, uint64_t size) {
// todo
return NULL;
}
static void *vhaRealloc(SMemAllocator *pma, void *ptr, uint64_t size) {
/* TODO */
return NULL;
}
static void vhaFree(SMemAllocator *pma, void *ptr) { /* TODO */
}
static uint64_t vhaUsage(SMemAllocator *pma) {
/* TODO */
return 0;
}
/* ------------------------ Arena Allocator ------------------------ */
typedef struct {
} SVArenaAllocator;