Turnstone Operating System
Loading...
Searching...
No Matches
tosdb_cache.64.c File Reference

tosdb cache interface implementation More...

#include <tosdb/tosdb_cache.h>
#include <tosdb/tosdb_internal.h>
#include <cache.h>
#include <logging.h>
#include <xxhash.h>

Classes

struct  tosdb_cache_t
 tosdb cache structure More...
 

Functions

 MODULE ("turnstone.kernel.db")
 
uint64_t tosdb_cache_key_generator (const void *item)
 tosdb cache key generator More...
 
int8_t tosdb_cache_key_comparator (const void *item1, const void *item2)
 tosdb cache key comparator More...
 
boolean_t tosdb_cache_item_key_destroyer (const void *key, const void *item)
 tosdb cache item key destroyer More...
 
tosdb_cache_ttosdb_cache_new (tosdb_cache_config_t *config)
 creates new tosdb cache More...
 
boolean_t tosdb_cache_close (tosdb_cache_t *cache)
 deletes tosdb cache More...
 
const tosdb_cache_key_ttosdb_cache_get (tosdb_cache_t *cache, tosdb_cache_key_t *key)
 gets tosdb cache item More...
 
boolean_t tosdb_cache_put (tosdb_cache_t *cache, tosdb_cache_key_t *key)
 puts tosdb cache item More...
 

Detailed Description

tosdb cache interface implementation

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Function Documentation

◆ MODULE()

MODULE ( "turnstone.kernel.db"  )

module name

◆ tosdb_cache_close()

boolean_t tosdb_cache_close ( tosdb_cache_t cache)

deletes tosdb cache

Parameters
cachetosdb cache
Returns
true if success, false otherwise

◆ tosdb_cache_get()

const tosdb_cache_key_t * tosdb_cache_get ( tosdb_cache_t cache,
tosdb_cache_key_t key 
)

gets tosdb cache item

Parameters
cachetosdb cache
keycache key
Returns
tosdb cache item if success, NULL otherwise

◆ tosdb_cache_item_key_destroyer()

boolean_t tosdb_cache_item_key_destroyer ( const void *  key,
const void *  item 
)

tosdb cache item key destroyer

Parameters
keykey of item
itemitem to destroy
Returns
true if item is destroyed, false otherwise

◆ tosdb_cache_key_comparator()

int8_t tosdb_cache_key_comparator ( const void *  item1,
const void *  item2 
)

tosdb cache key comparator

Parameters
item1item1 to compare
item2item2 to compare
Returns
0 if item1 == item2, -1 if item1 < item2, 1 if item1 > item2

◆ tosdb_cache_key_generator()

uint64_t tosdb_cache_key_generator ( const void *  item)

tosdb cache key generator

Parameters
itemitem to create key
Returns
key which is generated from item with xxhash64 algorithm

◆ tosdb_cache_new()

tosdb_cache_t * tosdb_cache_new ( tosdb_cache_config_t config)

creates new tosdb cache

Parameters
configcache config
Returns
tosdb cache if success, NULL otherwise

◆ tosdb_cache_put()

boolean_t tosdb_cache_put ( tosdb_cache_t cache,
tosdb_cache_key_t key 
)

puts tosdb cache item

Parameters
cachetosdb cache
keycache key
Returns
true if success, false otherwise