An extensible data structure for massive streaming graphs
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "stinger-physmap.h"
#include "stinger-atomics.h"
Macros | |
#define | MARKERINT INT64_MAX |
#define | CHILDREN_COUNT 256 |
Typedefs | |
typedef struct tree_node | tree_node_t |
Functions | |
tree_node_t * | allocateTreeNode (stinger_physmap_t *map, tree_node_t *parent, uint64_t depth, char value) |
int | insertIntoTree (stinger_physmap_t *map, tree_node_t **node, char *string, uint64_t length) |
stinger_physmap_t * | stinger_physmap_create () |
Allocate and initialize a new physical mapper. | |
void | stinger_physmap_delete (stinger_physmap_t *map) |
Free a physical mapper. | |
uint64_t | stinger_physmap_create_mapping (stinger_physmap_t *map, char *string, uint64_t length) |
Create a new mapping from a binary data string to a vertex ID. | |
uint64_t | stinger_physmap_get_mapping (stinger_physmap_t *map, char *string, uint64_t length) |
Lookup a mapping from a binary data string to a vertex ID. | |
int | stinger_physmap_get_key (stinger_physmap_t *map, char **outbuffer, uint64_t *outbufferlength, uint64_t vertexID) |
Lookup the string mapped to a particular vertex ID. | |
uint64_t | stinger_physmap_remove_mapping (stinger_physmap_t *map, uint64_t vertexID) |
Variables | |
uint64_t | MARKER_ |
void * | MARKER = (void *)&MARKER_ |
#define CHILDREN_COUNT 256 |
#define MARKERINT INT64_MAX |
Referenced by insertIntoTree(), and stinger_physmap_create_mapping().
typedef struct tree_node tree_node_t |
tree_node_t * allocateTreeNode | ( | stinger_physmap_t * | map, |
tree_node_t * | parent, | ||
uint64_t | depth, | ||
char | value | ||
) |
References MAX_NODES.
Referenced by insertIntoTree(), and stinger_physmap_create().
int insertIntoTree | ( | stinger_physmap_t * | map, |
tree_node_t ** | node, | ||
char * | string, | ||
uint64_t | length | ||
) |
References allocateTreeNode(), MARKER, and MARKERINT.
Referenced by stinger_physmap_create_mapping().
stinger_physmap_t* stinger_physmap_create | ( | ) |
Allocate and initialize a new physical mapper.
The user is responsible for freeing via stinger_physmap_delete().
References allocateTreeNode().
uint64_t stinger_physmap_create_mapping | ( | stinger_physmap_t * | map, |
char * | string, | ||
uint64_t | length | ||
) |
Create a new mapping from a binary data string to a vertex ID.
This function will uniquely map an arbitrary binary string or character string to a vertex ID in the space of 0 to NV where NV is the number of unique strings that have been mapped thus far (in other words the vertex ID space is compact). It will return -1 on error or if the mapping already exists. It is safe to call this function in parallel with any other physical mapper function. To determine if a -1 result is from an error, call stinger_physmap_get_mapping() on the same string. If it also returns -1, then an error has occurred.
map | The physical mapper. |
string | The binary or character data string. |
length | The length of the string. |
References insertIntoTree(), MARKERINT, and MAX_VTXID.
void stinger_physmap_delete | ( | stinger_physmap_t * | map | ) |
Free a physical mapper.
map | The physical mapper to be freed. |
int stinger_physmap_get_key | ( | stinger_physmap_t * | map, |
char ** | outbuffer, | ||
uint64_t * | outbufferlength, | ||
uint64_t | vertexID | ||
) |
Lookup the string mapped to a particular vertex ID.
This function will lookup and return a previously created mapping. It will return -1 no mapping exists or a reallocation of the output buffer fails. If the output buffer is not long enough, this function will reallocate the buffer and update the output buffer length. It is safe to call this function in parallel with any other physical mapper function.
map | The physical mapper. |
outbuffer | A buffer to store the output string. |
outbufferlength | The length of the buffer. |
vertexID | The vertex ID to reverse lookup. |
uint64_t stinger_physmap_get_mapping | ( | stinger_physmap_t * | map, |
char * | string, | ||
uint64_t | length | ||
) |
Lookup a mapping from a binary data string to a vertex ID.
This function will lookup and return a previously created mapping. It will return -1 if no mapping exists. It is safe to call this function in parallel with any other physical mapper function.
map | The physical mapper. |
string | The binary or character data string. |
length | The length of the string. |
uint64_t stinger_physmap_remove_mapping | ( | stinger_physmap_t * | map, |
uint64_t | vertexID | ||
) |
void* MARKER = (void *)&MARKER_ |
Referenced by insertIntoTree(), readfe(), readff(), writeef(), and writeff().
uint64_t MARKER_ |
comments powered by Disqus