Drizzled Public API Documentation

dyn0dyn.h File Reference
#include "univ.i"
#include "ut0lst.h"
#include "mem0mem.h"

Go to the source code of this file.

Classes

struct  dyn_block_struct
 A block in a dynamically allocated array. NOTE! Do not access the fields of the struct directly: the definition appears here only for the compiler to know its size! More...

Macros

#define dyn0dyn_h
#define DYN_ARRAY_DATA_SIZE   512

Typedefs

typedef struct dyn_block_struct dyn_block_t
typedef dyn_block_t dyn_array_t

Functions

UNIV_INLINE dyn_array_tdyn_array_create (dyn_array_t *arr)
UNIV_INLINE void dyn_array_free (dyn_array_t *arr)
UNIV_INLINE byte * dyn_array_open (dyn_array_t *arr, ulint size)
UNIV_INLINE void dyn_array_close (dyn_array_t *arr, byte *ptr)
UNIV_INLINE void * dyn_array_push (dyn_array_t *arr, ulint size)
UNIV_INLINE void * dyn_array_get_element (dyn_array_t *arr, ulint pos)
UNIV_INLINE ulint dyn_array_get_data_size (dyn_array_t *arr)
UNIV_INLINE dyn_block_tdyn_array_get_first_block (dyn_array_t *arr)
UNIV_INLINE dyn_block_tdyn_array_get_last_block (dyn_array_t *arr)
UNIV_INLINE dyn_block_tdyn_array_get_next_block (dyn_array_t *arr, dyn_block_t *block)
UNIV_INLINE ulint dyn_block_get_used (dyn_block_t *block)
UNIV_INLINE byte * dyn_block_get_data (dyn_block_t *block)
UNIV_INLINE void dyn_push_string (dyn_array_t *arr, const byte *str, ulint len)

Detailed Description

The dynamically allocated array

Created 2/5/1996 Heikki Tuuri

Definition in file dyn0dyn.h.


Macro Definition Documentation

#define DYN_ARRAY_DATA_SIZE   512

This is the initial 'payload' size of a dynamic array; this must be > MLOG_BUF_MARGIN + 30!

Definition at line 42 of file dyn0dyn.h.

Referenced by mlog_open_and_write_index().


Typedef Documentation

Dynamically allocated array

Definition at line 37 of file dyn0dyn.h.

typedef struct dyn_block_struct dyn_block_t

A block in a dynamically allocated array

Definition at line 35 of file dyn0dyn.h.


Function Documentation

UNIV_INLINE void dyn_array_close ( dyn_array_t arr,
byte *  ptr 
)

Closes the buffer returned by dyn_array_open. in: buffer space from ptr up was not used

Parameters:
arrin: dynamic array
UNIV_INLINE dyn_array_t* dyn_array_create ( dyn_array_t arr)

Initializes a dynamic array.

Returns:
initialized dyn array in: pointer to a memory buffer of size sizeof(dyn_array_t)
UNIV_INLINE void dyn_array_free ( dyn_array_t arr)

Frees a dynamic array. in: dyn array

Referenced by mtr_commit().

UNIV_INLINE ulint dyn_array_get_data_size ( dyn_array_t arr)

Returns the size of stored data in a dyn array.

Returns:
data size in bytes in: dyn array

Referenced by mtr_memo_release(), mtr_rollback_to_savepoint(), and page_copy_rec_list_end_to_created_page().

UNIV_INLINE void* dyn_array_get_element ( dyn_array_t arr,
ulint  pos 
)

Returns pointer to an element in dyn array.

Returns:
pointer to element in: position of element as bytes from array start
Parameters:
arrin: dyn array

Referenced by mtr_memo_release(), and mtr_rollback_to_savepoint().

UNIV_INLINE dyn_block_t* dyn_array_get_first_block ( dyn_array_t arr)

Gets the first block in a dyn array. in: dyn array

UNIV_INLINE dyn_block_t* dyn_array_get_last_block ( dyn_array_t arr)

Gets the last block in a dyn array. in: dyn array

UNIV_INLINE dyn_block_t* dyn_array_get_next_block ( dyn_array_t arr,
dyn_block_t block 
)

Gets the next block in a dyn array.

Returns:
pointer to next, NULL if end of list in: dyn array block
Parameters:
arrin: dyn array
UNIV_INLINE byte* dyn_array_open ( dyn_array_t arr,
ulint  size 
)

Makes room on top of a dyn array and returns a pointer to a buffer in it. After copying the elements, the caller must close the buffer using dyn_array_close.

Returns:
pointer to the buffer in: size in bytes of the buffer; MUST be smaller than DYN_ARRAY_DATA_SIZE!
Parameters:
arrin: dynamic array
UNIV_INLINE void* dyn_array_push ( dyn_array_t arr,
ulint  size 
)

Makes room on top of a dyn array and returns a pointer to the added element. The caller must copy the element to the pointer returned.

Returns:
pointer to the element in: size in bytes of the element
Parameters:
arrin: dynamic array
UNIV_INLINE byte* dyn_block_get_data ( dyn_block_t block)

Gets pointer to the start of data in a dyn array block.

Returns:
pointer to data in: dyn array block
UNIV_INLINE ulint dyn_block_get_used ( dyn_block_t block)

Gets the number of used bytes in a dyn array block.

Returns:
number of bytes used in: dyn array block
UNIV_INLINE void dyn_push_string ( dyn_array_t arr,
const byte *  str,
ulint  len 
)

Pushes n bytes to a dyn array. in: string length

Parameters:
arrin: dyn array
strin: string to write

Referenced by mlog_catenate_string().