omap-iter.c 680 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*
 * (C) 2017 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */
#include <stdlib.h>
#include "libmobject-store.h"
#include "src/omap-iter/omap-iter-impl.h"

int mobject_store_omap_get_next(mobject_store_omap_iter_t iter,
                                char **key,
                                char **val,
                                size_t *len)
{
    if(iter->current == NULL) return -1;

    *key = iter->current->key;
    *val = iter->current->value;
    *len = iter->current->value_size;

    iter->current = iter->current->next;

    return 0;
}

void mobject_store_omap_get_end(mobject_store_omap_iter_t iter)
{
    omap_iter_free(iter);
}