SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
sion_keyvalue.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** SIONLIB http://www.fz-juelich.de/jsc/sionlib **
3 *****************************************************************************
4 ** Copyright (c) 2008-2019 **
5 ** Forschungszentrum Juelich, Juelich Supercomputing Centre **
6 ** **
7 ** See the file COPYRIGHT in the package base directory for details **
8 ****************************************************************************/
9 
14 #ifndef SION_SION_KEYVALUE_H
15 #define SION_SION_KEYVALUE_H
16 
17 #include <stdint.h>
18 
19 #include "sion_const.h"
20 #include "sion_common.h"
21 #include "sion_filedesc.h"
22 
23 /* read data stored in record under 'key' in current trunk, SION will maintain a file
24  position per key so that subsequent reads are starting at last position of
25  current record */
26 size_t sion_fwrite_key(const void *data, uint64_t key, size_t size, size_t nitems, int sid);
27 size_t sion_fread_key(void *data, uint64_t key, size_t size, size_t nitems, int sid);
28 
29 /* this function searches for a key and on success the file position will
30  be move to the searched key and position, so that the data can be read with
31  sion_fread_key
32  Parameters:
33  sid: sion id
34  key: key within its data the search should be performed
35  entrynum: Number of occurence of entry (in write order), or
36  SION_CURRENT_ENTRY, or
37  SION_ABSOLUTE_POS
38  posinentry: byte-position in entry, or absolute byte-position in
39  all entries in write-order (SION_ABSOLUTE_POS)
40 */
41 int sion_seek_key(int sid, uint64_t key, int entrynum, sion_int64 posinentry );
42 
43 /* scans input file for all information about all keys of this rank */
44 int sion_key_full_scan(int sid);
45 
46 /* fills a stat-data structure containing information about the key */
47 int sion_key_get_stat(int sid, uint64_t key, sion_key_stat_t *keystat);
48 
49 /* iterator for list of keys */
50 int sion_key_list_iterator_reset(int sid);
51 int sion_key_list_iterator_next(int sid, uint64_t *keyptr);
52 
53 /* reset iterator for current task */
55 /* get next record for current task, data itself has to be read with
56  sion_fread_key; this function will forward to next record although if data
57  of last record is not or only read by part */
58 int sion_fread_key_iterator_next(int sid, uint64_t *key, size_t *size);
59 
60 int sion_get_keyval_mode (int sid);
61 char* sion_keyval_type_to_str (int type);
62 
63 /* internal functions */
64 int _sion_keyval_check_env(_sion_filedesc *sion_filedesc, sion_int64 file_mode_flags);
65 int _sion_keyval_dup_dataptr(_sion_filedesc *sion_filedesc, _sion_filedesc *new_filedesc);
66 
67 int _sion_store_and_write_key_and_len(_sion_filedesc *sion_filedesc, uint64_t key, size_t len);
68 int _sion_write_value(_sion_filedesc *sion_filedesc, const void *data, uint64_t key, size_t len);
69 
70 int _sion_find_and_read_key_and_len(_sion_filedesc *sion_filedesc, uint64_t key, size_t len, size_t *datalen);
71 int _sion_read_value(_sion_filedesc *sion_filedesc, void *data, uint64_t key, size_t len);
72 
73 #endif
char * sion_keyval_type_to_str(int type)
Returns key value mode as string.
size_t sion_fwrite_key(const void *data, uint64_t key, size_t size, size_t nitems, int sid)
Writes data for key.
int sion_seek_key(int sid, uint64_t key, int entrynum, sion_int64 posinentry)
Seek to position in key.
int sion_get_keyval_mode(int sid)
Return selected mode for key value.
int sion_key_list_iterator_reset(int sid)
Resets key iterator.
int sion_key_full_scan(int sid)
Performs a full scan of all meta data in current file.
size_t sion_fread_key(void *data, uint64_t key, size_t size, size_t nitems, int sid)
Read data for key.
int sion_fread_key_iterator_reset(int sid)
Resets key iterator.
int sion_key_list_iterator_next(int sid, uint64_t *keyptr)
Forward to next key.
int sion_key_get_stat(int sid, uint64_t key, sion_key_stat_t *keystat)
get statistics about key
int sion_fread_key_iterator_next(int sid, uint64_t *key, size_t *size)
Forward to next key.
Sion File Descriptor Structure.
Definition: sion_filedesc.h:79