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 MAPPERVERSION1_H
37 #define MAPPERVERSION1_H
39 #include <xseg/xseg.h>
46 /* Maximum length of an object name in memory */
47 #define v1_max_objectlen (MAPPER_PREFIX_LEN + HEXLIFIED_SHA256_DIGEST_SIZE)
49 /* Required size in storage to store object information.
51 * transparency byte + max object len in disk
53 #define v1_objectsize_in_map (1 + SHA256_DIGEST_SIZE)
55 /* Map header contains:
59 #define v1_mapheader_size (sizeof (uint32_t) + sizeof(uint64_t))
61 int read_object_v1(struct map_node *mn, unsigned char *buf);
62 void object_to_map_v1(unsigned char* buf, struct map_node *mn);
63 struct xseg_request * prepare_write_object_v1(struct peer_req *pr,
64 struct map *map, struct map_node *mn);
65 //int read_map_v1(struct map *m, unsigned char * data);
66 int read_map_metadata_v1(struct map *map, unsigned char *metadata,
67 uint32_t metadata_len);
68 int load_map_data_v1(struct peer_req *pr, struct map *map);
69 int write_map_metadata_v1(struct peer_req *pr, struct map *map);
70 int write_map_data_v1(struct peer_req *pr, struct map *map);
72 /*.read_map = read_map_v1, \*/
73 #define map_functions_v1 { \
74 .object_to_map = object_to_map_v1, \
75 .read_object = read_object_v1, \
76 .prepare_write_object = prepare_write_object_v1,\
77 .load_map_data = load_map_data_v1, \
78 .write_map_metadata = write_map_metadata_v1, \
79 .write_map_data = write_map_data_v1, \
80 .read_map_metadata = read_map_metadata_v1 \
82 #endif /* end MAPPERVERSION1_H */