MySQL 8.3.0
Source Code Documentation
ha0storage.cc File Reference

Hash storage. More...

#include "ha0storage.h"
#include "ha_prototypes.h"
#include "hash0hash.h"
#include "mem0mem.h"
#include "ut0rnd.h"

Macros

#define IS_FOUND    node->data_len == data_len &&memcmp(node->data, data, data_len) == 0
 

Functions

static const void * ha_storage_get (ha_storage_t *storage, const void *data, ulint data_len)
 Retrieves a data from a storage. More...
 
const void * ha_storage_put_memlim (ha_storage_t *storage, const void *data, ulint data_len, ulint memlim)
 Copies data into the storage and returns a pointer to the copy. More...
 

Detailed Description

Hash storage.

Provides a data structure that stores chunks of data in its own storage, avoiding duplicates.

Created September 22, 2007 Vasil Dimov

Macro Definition Documentation

◆ IS_FOUND

#define IS_FOUND    node->data_len == data_len &&memcmp(node->data, data, data_len) == 0

Function Documentation

◆ ha_storage_get()

static const void * ha_storage_get ( ha_storage_t storage,
const void *  data,
ulint  data_len 
)
static

Retrieves a data from a storage.

If it is present, a pointer to the stored copy of data is returned, otherwise NULL is returned.

Parameters
storagein: hash storage
datain: data to check for
data_lenin: data length

◆ ha_storage_put_memlim()

const void * ha_storage_put_memlim ( ha_storage_t storage,
const void *  data,
ulint  data_len,
ulint  memlim 
)

Copies data into the storage and returns a pointer to the copy.

If the same data chunk is already present, then pointer to it is returned. Data chunks are considered to be equal if len1 == len2 and memcmp(data1, data2, len1) == 0. If "data" is not present (and thus data_len bytes need to be allocated) and the size of storage is going to become more than "memlim" then "data" is not added and NULL is returned. To disable this behavior "memlim" can be set to 0, which stands for "no limit".

Parameters
storagein/out: hash storage
datain: data to store
data_lenin: data length
memlimin: memory limit to obey