RetroArch
Classes | Macros | Typedefs | Functions | Variables
libretrodb.c File Reference
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <streams/file_stream.h>
#include <retro_endianness.h>
#include <string/stdstring.h>
#include <compat/strl.h>
#include "libretrodb.h"
#include "rmsgpack_dom.h"
#include "rmsgpack.h"
#include "bintree.h"
#include "query.h"
Include dependency graph for libretrodb.c:

Classes

struct  node_iter_ctx
 
struct  libretrodb
 
struct  libretrodb_index
 
struct  libretrodb_metadata
 
struct  libretrodb_header
 
struct  libretrodb_cursor
 

Macros

#define MAGIC_NUMBER   "RARCHDB"
 

Typedefs

typedef struct libretrodb_metadata libretrodb_metadata_t
 
typedef struct libretrodb_header libretrodb_header_t
 

Functions

static int libretrodb_read_metadata (RFILE *fd, libretrodb_metadata_t *md)
 
static int libretrodb_write_metadata (RFILE *fd, libretrodb_metadata_t *md)
 
static int libretrodb_validate_document (const struct rmsgpack_dom_value *doc)
 
int libretrodb_create (RFILE *fd, libretrodb_value_provider value_provider, void *ctx)
 
static int libretrodb_read_index_header (RFILE *fd, libretrodb_index_t *idx)
 
static void libretrodb_write_index_header (RFILE *fd, libretrodb_index_t *idx)
 
void libretrodb_close (libretrodb_t *db)
 
int libretrodb_open (const char *path, libretrodb_t *db)
 
static int libretrodb_find_index (libretrodb_t *db, const char *index_name, libretrodb_index_t *idx)
 
static int binsearch (const void *buff, const void *item, uint64_t count, uint8_t field_size, uint64_t *offset)
 
int libretrodb_find_entry (libretrodb_t *db, const char *index_name, const void *key, struct rmsgpack_dom_value *out)
 
int libretrodb_cursor_reset (libretrodb_cursor_t *cursor)
 
int libretrodb_cursor_read_item (libretrodb_cursor_t *cursor, struct rmsgpack_dom_value *out)
 
void libretrodb_cursor_close (libretrodb_cursor_t *cursor)
 
int libretrodb_cursor_open (libretrodb_t *db, libretrodb_cursor_t *cursor, libretrodb_query_t *q)
 
static int node_iter (void *value, void *ctx)
 
static uint64_t libretrodb_tell (libretrodb_t *db)
 
static int node_compare (const void *a, const void *b, void *ctx)
 
int libretrodb_create_index (libretrodb_t *db, const char *name, const char *field_name)
 
libretrodb_cursor_tlibretrodb_cursor_new (void)
 
void libretrodb_cursor_free (libretrodb_cursor_t *dbc)
 
libretrodb_tlibretrodb_new (void)
 
void libretrodb_free (libretrodb_t *db)
 

Variables

static struct rmsgpack_dom_value sentinal
 

Macro Definition Documentation

◆ MAGIC_NUMBER

#define MAGIC_NUMBER   "RARCHDB"

Typedef Documentation

◆ libretrodb_header_t

◆ libretrodb_metadata_t

Function Documentation

◆ binsearch()

static int binsearch ( const void buff,
const void item,
uint64_t  count,
uint8_t  field_size,
uint64_t offset 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_close()

void libretrodb_close ( libretrodb_t db)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_create()

int libretrodb_create ( RFILE fd,
libretrodb_value_provider  value_provider,
void ctx 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_create_index()

int libretrodb_create_index ( libretrodb_t db,
const char *  name,
const char *  field_name 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_cursor_close()

void libretrodb_cursor_close ( libretrodb_cursor_t cursor)

libretrodb_cursor_close: : Handle to database cursor.

Closes cursor and frees up allocated memory.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_cursor_free()

void libretrodb_cursor_free ( libretrodb_cursor_t dbc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_cursor_new()

libretrodb_cursor_t* libretrodb_cursor_new ( void  )
Here is the caller graph for this function:

◆ libretrodb_cursor_open()

int libretrodb_cursor_open ( libretrodb_t db,
libretrodb_cursor_t cursor,
libretrodb_query_t q 
)

libretrodb_cursor_open: : Handle to database. : Handle to database cursor. : Query to execute.

Opens cursor to database based on query .

Returns: 0 if successful, otherwise negative.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_cursor_read_item()

int libretrodb_cursor_read_item ( libretrodb_cursor_t cursor,
struct rmsgpack_dom_value out 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_cursor_reset()

int libretrodb_cursor_reset ( libretrodb_cursor_t cursor)

libretrodb_cursor_reset: : Handle to database cursor.

Resets cursor.

Returns: ???.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_find_entry()

int libretrodb_find_entry ( libretrodb_t db,
const char *  index_name,
const void key,
struct rmsgpack_dom_value out 
)
Here is the call graph for this function:

◆ libretrodb_find_index()

static int libretrodb_find_index ( libretrodb_t db,
const char *  index_name,
libretrodb_index_t idx 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_free()

void libretrodb_free ( libretrodb_t db)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_new()

libretrodb_t* libretrodb_new ( void  )
Here is the caller graph for this function:

◆ libretrodb_open()

int libretrodb_open ( const char *  path,
libretrodb_t db 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_read_index_header()

static int libretrodb_read_index_header ( RFILE fd,
libretrodb_index_t idx 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_read_metadata()

static int libretrodb_read_metadata ( RFILE fd,
libretrodb_metadata_t md 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_tell()

static uint64_t libretrodb_tell ( libretrodb_t db)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_validate_document()

static int libretrodb_validate_document ( const struct rmsgpack_dom_value doc)
static
Here is the caller graph for this function:

◆ libretrodb_write_index_header()

static void libretrodb_write_index_header ( RFILE fd,
libretrodb_index_t idx 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libretrodb_write_metadata()

static int libretrodb_write_metadata ( RFILE fd,
libretrodb_metadata_t md 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_compare()

static int node_compare ( const void a,
const void b,
void ctx 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_iter()

static int node_iter ( void value,
void ctx 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sentinal

struct rmsgpack_dom_value sentinal
static