#include <map.h>
#include <hashmap_tx.h>
#include "map_hashmap_tx.h"
static int
map_hm_tx_check(PMEMobjpool *pop, TOID(struct map) map)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_check(pop, hashmap_tx);
}
static size_t
map_hm_tx_count(PMEMobjpool *pop, TOID(struct map) map)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_count(pop, hashmap_tx);
}
static int
map_hm_tx_init(PMEMobjpool *pop, TOID(struct map) map)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_init(pop, hashmap_tx);
}
static int
map_hm_tx_create(PMEMobjpool *pop, TOID(struct map) *map, void *arg)
{
TOID(struct hashmap_tx) *hashmap_tx =
(TOID(struct hashmap_tx) *)map;
return hm_tx_create(pop, hashmap_tx, arg);
}
static int
map_hm_tx_insert(PMEMobjpool *pop, TOID(struct map) map,
uint64_t key, PMEMoid value)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_insert(pop, hashmap_tx, key, value);
}
static PMEMoid
map_hm_tx_remove(PMEMobjpool *pop, TOID(struct map) map, uint64_t key)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_remove(pop, hashmap_tx, key);
}
static PMEMoid
map_hm_tx_get(PMEMobjpool *pop, TOID(struct map) map, uint64_t key)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_get(pop, hashmap_tx, key);
}
static int
map_hm_tx_lookup(PMEMobjpool *pop, TOID(struct map) map, uint64_t key)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_lookup(pop, hashmap_tx, key);
}
static int
map_hm_tx_foreach(PMEMobjpool *pop, TOID(struct map) map,
int (*cb)(uint64_t key, PMEMoid value, void *arg),
void *arg)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_foreach(pop, hashmap_tx, cb, arg);
}
static int
map_hm_tx_cmd(PMEMobjpool *pop, TOID(struct map) map,
unsigned cmd, uint64_t arg)
{
TOID(struct hashmap_tx) hashmap_tx;
TOID_ASSIGN(hashmap_tx, map.oid);
return hm_tx_cmd(pop, hashmap_tx, cmd, arg);
}
struct map_ops hashmap_tx_ops = {
map_hm_tx_check,
map_hm_tx_create,
NULL,
map_hm_tx_init,
map_hm_tx_insert,
NULL,
map_hm_tx_remove,
NULL,
NULL,
map_hm_tx_get,
map_hm_tx_lookup,
map_hm_tx_foreach,
NULL,
map_hm_tx_count,
map_hm_tx_cmd,
};