Skip to content

Commit

Permalink
Updated readme & little cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TriKaspar committed Jul 20, 2012
1 parent 7de9969 commit 7e46a03
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
19 changes: 9 additions & 10 deletions README.md
@@ -1,14 +1,6 @@
#Riack
Is a C client library for Riak.

##Precompiled
The easiest thing to do is just use the precompiled libraries you can download them from the files section: https://github.com/trifork/riack/downloads

##Examples
I wan't this library to be as easy as possible to use, so all you need to get started is the shared library file and 2 headers!
To se examples of this look in the examples directory.
Remember you need to compile the library or download the precompiled files before the examples will run.

##Compilation
###Dependencies

Expand Down Expand Up @@ -53,11 +45,18 @@ Note on windows you might need to tell cmake where to find the Protobuf-C files
You can do this by passing some options to cmake which is hard to remember ;) I recommend
to just edit src\cmake\Modules\FindProtoBufC.cmake lines 19 & 20.

##Examples
To se examples of this look in the examples directory.
Before the examples can run you must place the compiled library files in the precompiled folder (see the precompiled/README.md file for details).


##Tests
To run the test first input an ip/port in src/CMakeLists.txt line 4 & 5 and rerun cmake
To make all tests succeed you need a running riak server with eleveldb backend.
If your server is running on localhost with port 8081 set as protocol buffer port, you can run it right away, if not you need to input the ip and port in src/CMakeLists.txt line 4 & 5 and rerun cmake
When ready you can simply do a make test.
(on windows just choose the correct build target in Visual Studio)

##Disclamer
This is a sparetime project, so if you so a silly bug don't blame my employer, instead
make a pull request ;)
make a pull request ;)

2 changes: 0 additions & 2 deletions precompiled/README.md
Expand Up @@ -12,5 +12,3 @@ riack.dylib
##On linux
riack.so

#Downloading
If you do not wish to be bothered with compiling you can download the precompiled files from here http://kaspar.mobi/files/riack-binaries/
4 changes: 2 additions & 2 deletions src/riack_defines.h
Expand Up @@ -103,7 +103,7 @@ struct RIACK_CONTENT
RIACK_STRING content_encoding;
RIACK_STRING vtag;
size_t link_count;
struct RIACK_LINK** links;
struct RIACK_LINK* links;
//
uint8_t last_modified_present;
uint32_t last_modified;
Expand All @@ -113,7 +113,7 @@ struct RIACK_CONTENT
uint8_t deleted;
//
size_t usermeta_count;
struct RIACK_PAIR **usermetas;
struct RIACK_PAIR *usermetas;
size_t index_count;
struct RIACK_PAIR *indexes;
};
Expand Down
16 changes: 8 additions & 8 deletions src/riack_helpers.c
Expand Up @@ -139,15 +139,15 @@ void riak_free_copied_content(struct RIACK_CLIENT* client, struct RIACK_CONTENT
cnt = pcontent->usermeta_count;
if (cnt > 0) {
for (i=0; i<cnt; ++i) {
riak_free_copied_pair(client, pcontent->usermetas[i]);
riak_free_copied_pair(client, &pcontent->usermetas[i]);
}
RFREE(client,pcontent->usermetas);
}

cnt = pcontent->link_count;
if (cnt > 0) {
for (i=0; i<cnt; ++i) {
riak_free_copied_link(client, pcontent->links[i]);
riak_free_copied_link(client, &pcontent->links[i]);
}
RFREE(client,pcontent->links);
}
Expand Down Expand Up @@ -389,7 +389,7 @@ void riack_copy_content_to_rpbcontent(struct RIACK_CLIENT* client, struct RIACK_
ppbc_content->links = (RpbLink**)RMALLOC(client, sizeof(RpbLink**) * pcontent->link_count);
for (i=0; i<pcontent->link_count; ++i) {
ppbc_content->links[i] = (RpbLink*)RMALLOC(client, sizeof(RpbLink));
riak_copy_link_to_rpblink(client, pcontent->links[i], ppbc_content->links[i]);
riak_copy_link_to_rpblink(client, &pcontent->links[i], ppbc_content->links[i]);
}
}

Expand All @@ -405,7 +405,7 @@ void riack_copy_content_to_rpbcontent(struct RIACK_CLIENT* client, struct RIACK_
ppbc_content->usermeta = (RpbPair**)RMALLOC(client, sizeof(RpbPair**) * pcontent->usermeta_count);
for (i=0; i<pcontent->usermeta_count; ++i) {
ppbc_content->usermeta[i] = (RpbPair*)RMALLOC(client, sizeof(RpbPair));
riak_copy_pair_to_rpbpair(client, pcontent->usermetas[i], ppbc_content->usermeta[i]);
riak_copy_pair_to_rpbpair(client, &pcontent->usermetas[i], ppbc_content->usermeta[i]);
}
}

Expand Down Expand Up @@ -469,18 +469,18 @@ void riack_copy_rpbcontent_to_content(struct RIACK_CLIENT* client, RpbContent *s
cnt = src->n_usermeta;
target->usermeta_count = cnt;
if (cnt > 0) {
*target->usermetas = (struct RIACK_PAIR*)RMALLOC(client, sizeof(struct RIACK_PAIR*) * cnt);
target->usermetas = (struct RIACK_PAIR*)RMALLOC(client, sizeof(struct RIACK_PAIR) * cnt);
for (i=0; i<cnt; ++i) {
riak_copy_rpbpair_to_pair(client, src->usermeta[i], target->usermetas[i]);
riak_copy_rpbpair_to_pair(client, src->usermeta[i], &target->usermetas[i]);
}
}

cnt = src->n_links;
target->link_count = cnt;
if (cnt > 0) {
*target->links = (struct RIACK_LINK*)RMALLOC(client, sizeof(struct RIACK_LINK*) * cnt);
target->links = (struct RIACK_LINK*)RMALLOC(client, sizeof(struct RIACK_LINK) * cnt);
for (i=0; i<cnt; ++i) {
riak_copy_rpblink_to_link(client, src->links[i], target->links[i]);
riak_copy_rpblink_to_link(client, src->links[i], &target->links[i]);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/tests/test_2i.c
Expand Up @@ -109,6 +109,7 @@ int test_2i_range()
result = 2;
break;
}
riack_free_string_list(test_client, &keys);
}

return result;
Expand Down

0 comments on commit 7e46a03

Please sign in to comment.