2 * Copyright 2013 GRNET S.A. All rights reserved.
4 * Redistribution and use in source and binary forms, with or
5 * without modification, are permitted provided that the following
8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following
11 * 2. Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials
14 * provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
29 * The views and conclusions contained in the software and
30 * documentation are those of the authors and should not be
31 * interpreted as representing official policies, either expressed
32 * or implied, of GRNET S.A.
35 #ifndef MAPPERVERSION0_H
37 #define MAPPERVERSION0_H
44 /* version 0 functions */
47 #define v0_mapheader_size 0
49 /* Maximum length of an object name in memory */
50 #define v0_max_objectlen (HEXLIFIED_SHA256_DIGEST_SIZE)
52 /* Required size in storage to store object information.
54 * max object len in disk. just the unhexlified name.
56 #define v0_objectsize_in_map (SHA256_DIGEST_SIZE)
58 int read_object_v0(struct map_node *mn, unsigned char *buf);
59 void object_to_map_v0(unsigned char* buf, struct map_node *mn);
60 struct xseg_request * prepare_write_object_v0(struct peer_req *pr,
61 struct map *map, struct map_node *mn);
62 //int read_map_v0(struct map *m, unsigned char * data);
63 int read_map_metadata_v0(struct map *map, unsigned char *metadata,
64 uint32_t metadata_len);
65 int load_map_data_v0(struct peer_req *pr, struct map *map);
66 int write_map_metadata_v0(struct peer_req *pr, struct map *map);
67 int write_map_data_v0(struct peer_req *pr, struct map *map);
69 /*.read_map = read_map_v0, \*/
70 #define map_functions_v0 { \
71 .object_to_map = object_to_map_v0, \
72 .read_object = read_object_v0, \
73 .prepare_write_object = prepare_write_object_v0,\
74 .load_map_data = load_map_data_v0, \
75 .write_map_metadata = write_map_metadata_v0, \
76 .write_map_data = write_map_data_v0, \
77 .read_map_metadata = read_map_metadata_v0 \
81 #endif /* end MAPPERVERSION0_H */