Mercurial > nomad > old-fuse
changeset 9:a7fb129be830
common: define object id and vector clock structures
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 28 Jun 2015 19:23:46 -0400 |
parents | a30258aa9e6e |
children | 1ba107644ce4 |
files | src/CMakeLists.txt src/common/include/nomad/types.h |
diffstat | 2 files changed, 51 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/CMakeLists.txt Sun Jun 28 16:20:45 2015 -0400 +++ b/src/CMakeLists.txt Sun Jun 28 19:23:46 2015 -0400 @@ -23,6 +23,7 @@ include_directories( sunavl/include sunlist/include + common/include ) add_subdirectory(sunavl)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/common/include/nomad/types.h Sun Jun 28 19:23:46 2015 -0400 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __NOMAD_TYPES_H +#define __NOMAD_TYPES_H + +#include <stdint.h> + +/* object id */ +typedef struct { + uint32_t ds; + uint32_t _reserved; /* must be zero */ + uint64_t uniq; +} noid_t; + +/* version vector */ +typedef struct nvclockent { + uint64_t node; + uint64_t seq; +} nvclockent_t; + +typedef struct { + uint16_t _reserved; /* must be zero */ + uint16_t nnodes; + struct nvclockent ent[0]; +} nvclock_t; + +extern nvclock_t *nvclock_alloc(uint16_t nodes); +extern void nvclock_free(nvclock_t *clock); + +#endif