SIONlib  1.7.1
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-2016 **
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 #include "sion.h"
19 
20 /* read data stored in record under 'key' in current trunk, SION will maintain a file
21  position per key so that subsequent reads are starting at last position of
22  current record */
23 size_t sion_fwrite_key(const void *data, uint64_t key, size_t size, size_t nitems, int sid);
24 size_t sion_fread_key(void *data, uint64_t key, size_t size, size_t nitems, int sid);
25 
26 /* this function searches for a key and on success the file position will
27  be move to the searched key and position, so that the data can be read with
28  sion_fread_key
29  Parameters:
30  sid: sion id
31  key: key within its data the search should be performed
32  entrynum: Number of occurence of entry (in write order), or
33  SION_CURRENT_ENTRY, or
34  SION_ABSOLUTE_POS
35  posinentry: byte-position in entry, or absolute byte-position in
36  all entries in write-order (SION_ABSOLUTE_POS)
37 */
38 int sion_seek_key(int sid, uint64_t key, int entrynum, sion_int64 posinentry );
39 
40 /* scans input file for all information about all keys of this rank */
41 int sion_key_full_scan(int sid);
42 
43 /* fills a stat-data structure containing information about the key */
44 int sion_key_get_stat(int sid, uint64_t key, sion_key_stat_t *keystat);
45 
46 /* iterator for list of keys */
47 int sion_key_list_iterator_reset(int sid);
48 int sion_key_list_iterator_next(int sid, uint64_t *keyptr);
49 
50 /* reset iterator for current task */
52 /* get next record for current task, data itself has to be read with
53  sion_fread_key; this function will forward to next record although if data
54  of last record is not or only read by part */
55 int sion_fread_key_iterator_next(int sid, uint64_t *key, size_t *size);
56 
57 int sion_get_keyval_mode (int sid);
58 char* sion_keyval_type_to_str (int type);
59 
60 /* internal functions */
61 int _sion_keyval_check_env(_sion_filedesc *sion_filedesc, sion_int64 file_mode_flags);
62 int _sion_keyval_dup_dataptr(_sion_filedesc *sion_filedesc, _sion_filedesc *new_filedesc);
63 
64 int _sion_store_and_write_key_and_len(_sion_filedesc *sion_filedesc, uint64_t key, size_t len);
65 int _sion_write_value(_sion_filedesc *sion_filedesc, const void *data, uint64_t key, size_t len);
66 
67 int _sion_find_and_read_key_and_len(_sion_filedesc *sion_filedesc, uint64_t key, size_t len, size_t *datalen);
68 int _sion_read_value(_sion_filedesc *sion_filedesc, void *data, uint64_t key, size_t len);
69 
70 #endif
int sion_seek_key(int sid, uint64_t key, int entrynum, sion_int64 posinentry)
Seek to position in key.
int sion_key_list_iterator_next(int sid, uint64_t *keyptr)
Forward to next key.
Sion File Descriptor Structure.
Definition: sion_filedesc.h:77
int sion_fread_key_iterator_next(int sid, uint64_t *key, size_t *size)
Forward to next key.
char * sion_keyval_type_to_str(int type)
Returns key value mode as string.
int sion_fread_key_iterator_reset(int sid)
Resets key iterator.
int sion_key_list_iterator_reset(int sid)
Resets key iterator.
int sion_get_keyval_mode(int sid)
Return selected mode for key value.
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.
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_key_get_stat(int sid, uint64_t key, sion_key_stat_t *keystat)
get statistics about key