2005-01-20 21:19:47 +00:00
|
|
|
/**
|
|
|
|
@file
|
|
|
|
|
|
|
|
Implements a linked list using nested top actions. Linked list
|
|
|
|
entries are key, value pairs, where the keys and values are of
|
|
|
|
fixed length.
|
|
|
|
|
|
|
|
@see nestedTopAction.h
|
|
|
|
|
|
|
|
@ingroup OPERATIONS
|
|
|
|
|
|
|
|
$id$
|
|
|
|
*/
|
|
|
|
|
2005-01-14 01:52:53 +00:00
|
|
|
#ifndef __LINKED_LIST_NTA_H
|
|
|
|
#define __LINKED_LIST_NTA_H
|
|
|
|
typedef struct {
|
|
|
|
recordid next;
|
2008-09-28 03:11:24 +00:00
|
|
|
} stasis_linkedList_entry;
|
2005-01-14 01:52:53 +00:00
|
|
|
typedef struct {
|
|
|
|
int keySize;
|
|
|
|
int valueSize;
|
|
|
|
recordid next;
|
|
|
|
/** The implementation of TlinkedListRemove always preserves
|
|
|
|
the location of the head of the linked list. Therefore,
|
|
|
|
if the first entry is removed, *and* the iterator just returned
|
|
|
|
the head of the list, then the iterator needs to reset itself. */
|
|
|
|
int first;
|
|
|
|
recordid listRoot;
|
2008-09-28 03:11:24 +00:00
|
|
|
} stasis_linkedList_iterator;
|
2005-01-14 01:52:53 +00:00
|
|
|
|
2005-02-22 23:11:03 +00:00
|
|
|
compensated_function int TlinkedListInsert(int xid, recordid list, const byte * key, int keySize, const byte * value, int valueSize);
|
|
|
|
compensated_function int TlinkedListFind(int xid, recordid list, const byte * key, int keySize, byte ** value);
|
|
|
|
compensated_function int TlinkedListRemove(int xid, recordid list, const byte * key, int keySize);
|
|
|
|
compensated_function int TlinkedListMove(int xid, recordid start_list, recordid end_list, const byte *key, int keySize);
|
2005-01-14 01:52:53 +00:00
|
|
|
/** The linked list iterator can tolerate the concurrent removal of values that
|
|
|
|
it has already returned. In the presence of such removals, the iterator
|
|
|
|
will return the keys and values present in the list as it existed when next()
|
|
|
|
was first called.
|
|
|
|
|
|
|
|
@return a new iterator initialized to the head of the list. */
|
2008-09-28 03:11:24 +00:00
|
|
|
compensated_function stasis_linkedList_iterator * TlinkedListIterator(int xid, recordid list, int keySize, int valueSize);
|
|
|
|
void TlinkedListClose(int xid, stasis_linkedList_iterator * it);
|
2005-01-14 01:52:53 +00:00
|
|
|
/** @return 1 if there was another entry to be iterated over. 0 otherwise.
|
|
|
|
If this function returns 1, the caller must free() the malloced memory
|
|
|
|
returned via the key and value arguments.*/
|
2008-09-28 03:11:24 +00:00
|
|
|
compensated_function int TlinkedListNext(int xid, stasis_linkedList_iterator * it, byte ** key, int * keySize, byte ** value, int * valueSize);
|
2005-02-22 23:11:03 +00:00
|
|
|
compensated_function recordid TlinkedListCreate(int xid, int keySize, int ValueSize);
|
|
|
|
compensated_function void TlinkedListDelete(int xid, recordid list);
|
2005-03-02 05:46:29 +00:00
|
|
|
|
2009-05-08 06:53:30 +00:00
|
|
|
void TlinkedListNTAInit();
|
2009-03-31 05:02:54 +00:00
|
|
|
stasis_operation_impl stasis_op_impl_linked_list_insert();
|
|
|
|
stasis_operation_impl stasis_op_impl_linked_list_remove();
|
2005-01-14 01:52:53 +00:00
|
|
|
#endif //__LINKED_LIST_NTA_H
|