MySQL 8.0.40
Source Code Documentation
|
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... | |
Hash storage.
Provides a data structure that stores chunks of data in its own storage, avoiding duplicates.
Created September 22, 2007 Vasil Dimov
#define IS_FOUND node->data_len == data_len &&memcmp(node->data, data, data_len) == 0 |
|
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.
storage | in: hash storage |
data | in: data to check for |
data_len | in: data length |
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".
storage | in/out: hash storage |
data | in: data to store |
data_len | in: data length |
memlim | in: memory limit to obey |