Move of node to merkledag

This commit is contained in:
jmjatlanta 2016-12-19 09:03:28 -05:00
parent 87f0cbedbc
commit a1166e840a
13 changed files with 43 additions and 29 deletions

View file

@ -11,7 +11,6 @@ all:
cd importer; make all; cd importer; make all;
cd merkledag; make all; cd merkledag; make all;
cd multibase; make all; cd multibase; make all;
cd node; make all;
cd os; make all; cd os; make all;
cd repo; make all; cd repo; make all;
cd flatfs; make all; cd flatfs; make all;
@ -28,7 +27,6 @@ clean:
cd importer; make clean; cd importer; make clean;
cd merkledag; make clean; cd merkledag; make clean;
cd multibase; make clean; cd multibase; make clean;
cd node; make clean;
cd os; make clean; cd os; make clean;
cd repo; make clean; cd repo; make clean;
cd flatfs; make clean; cd flatfs; make clean;

View file

@ -3,7 +3,7 @@
#include "ipfs/cid/cid.h" #include "ipfs/cid/cid.h"
#include "ipfs/merkledag/merkledag.h" #include "ipfs/merkledag/merkledag.h"
#include "ipfs/node/node.h" #include "ipfs/merkledag/node.h"
#include "ipfs/repo/fsrepo/fs_repo.h" #include "ipfs/repo/fsrepo/fs_repo.h"
/** /**
* pull objects from ipfs * pull objects from ipfs

View file

@ -1,7 +1,7 @@
#ifndef __IPFS_IMPORTER_IMPORTER_H__ #ifndef __IPFS_IMPORTER_IMPORTER_H__
#define __IPFS_IMPORTER_IMPORTER_H__ #define __IPFS_IMPORTER_IMPORTER_H__
#include "ipfs/node/node.h" #include "ipfs/merkledag/node.h"
#include "ipfs/repo/fsrepo/fs_repo.h" #include "ipfs/repo/fsrepo/fs_repo.h"
/** /**

View file

@ -4,7 +4,7 @@
#ifndef __IPFS_MERKLEDAG_H__ #ifndef __IPFS_MERKLEDAG_H__
#define __IPFS_MERKLEDAG_H__ #define __IPFS_MERKLEDAG_H__
#include "ipfs/node/node.h" #include "ipfs/merkledag/node.h"
#include "ipfs/repo/fsrepo/fs_repo.h" #include "ipfs/repo/fsrepo/fs_repo.h"
/*** /***

View file

@ -7,7 +7,7 @@ endif
LFLAGS = LFLAGS =
DEPS = DEPS =
OBJS = merkledag.o OBJS = merkledag.o node.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS)

View file

@ -8,7 +8,7 @@
#include "inttypes.h" #include "inttypes.h"
#include "ipfs/cid/cid.h" #include "ipfs/cid/cid.h"
#include "ipfs/node/node.h" #include "ipfs/merkledag/node.h"
// for protobuf Node data & data_size encoded cid link_amount & links // for protobuf Node data & data_size encoded cid link_amount & links
enum WireType ipfs_node_message_fields[] = { WIRETYPE_LENGTH_DELIMITED, WIRETYPE_LENGTH_DELIMITED, WIRETYPE_LENGTH_DELIMITED, WIRETYPE_LENGTH_DELIMITED }; enum WireType ipfs_node_message_fields[] = { WIRETYPE_LENGTH_DELIMITED, WIRETYPE_LENGTH_DELIMITED, WIRETYPE_LENGTH_DELIMITED, WIRETYPE_LENGTH_DELIMITED };

View file

@ -1,18 +0,0 @@
CC = gcc
CFLAGS = -O0 -I../include -I../../c-libp2p/include -I../../c-multihash/include -I../../c-multiaddr/include -I../../c-protobuf -Wall
ifdef DEBUG
CFLAGS += -g3
endif
LFLAGS =
DEPS =
OBJS = node.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
all: $(OBJS)
clean:
rm -f *.o

View file

@ -12,9 +12,8 @@ OBJS = testit.o test_helper.o \
../flatfs/flatfs.o \ ../flatfs/flatfs.o \
../importer/importer.o \ ../importer/importer.o \
../importer/exporter.o \ ../importer/exporter.o \
../merkledag/merkledag.o \ ../merkledag/merkledag.o ../merkledag/node.o \
../multibase/multibase.o \ ../multibase/multibase.o \
../node/node.o \
../os/utils.o \ ../os/utils.o \
../repo/fsrepo/fs_repo.o ../repo/fsrepo/jsmn.o ../repo/fsrepo/lmdb_datastore.o \ ../repo/fsrepo/fs_repo.o ../repo/fsrepo/jsmn.o ../repo/fsrepo/lmdb_datastore.o \
../repo/config/config.o ../repo/config/identity.o \ ../repo/config/config.o ../repo/config/identity.o \

View file

@ -1,5 +1,5 @@
#include "ipfs/merkledag/merkledag.h" #include "ipfs/merkledag/merkledag.h"
#include "ipfs/node/node.h" #include "ipfs/merkledag/node.h"
#include "../test_helper.h" #include "../test_helper.h"
struct FSRepo* createAndOpenRepo(const char* dir) { struct FSRepo* createAndOpenRepo(const char* dir) {

View file

@ -131,6 +131,41 @@ int test_import_large_file() {
size_t new_file_size = os_utils_file_size("/tmp/test_import_large_file.rsl"); size_t new_file_size = os_utils_file_size("/tmp/test_import_large_file.rsl");
if (new_file_size != bytes_size) { if (new_file_size != bytes_size) {
printf("File sizes are different. Should be %lu but the new one is %lu\n", bytes_size, new_file_size); printf("File sizes are different. Should be %lu but the new one is %lu\n", bytes_size, new_file_size);
ipfs_repo_fsrepo_free(fs_repo);
ipfs_node_free(write_node);
ipfs_node_free(read_node);
return 0;
}
FILE* f1 = fopen("/tmp/test_import_large.tmp", "rb");
FILE* f2 = fopen("/tmp/test_import_large_file.rsl", "rb");
size_t bytes_read1 = 1;
size_t bytes_read2 = 1;
unsigned char buf1[100];
unsigned char buf2[100];
// compare bytes of files
while (bytes_read1 != 0 && bytes_read2 != 0) {
bytes_read1 = fread(buf1, 1, 100, f1);
bytes_read2 = fread(buf2, 1, 100, f2);
if (bytes_read1 != bytes_read2) {
printf("Error reading files for comparison. Read %lu bytes of file 1, but %lu bytes of file 2\n", bytes_read1, bytes_read2);
ipfs_repo_fsrepo_free(fs_repo);
ipfs_node_free(write_node);
ipfs_node_free(read_node);
fclose(f1);
fclose(f2);
return 0;
}
if (memcmp(buf1, buf2, bytes_read1) != 0) {
printf("The bytes between the files are different\n");
ipfs_repo_fsrepo_free(fs_repo);
ipfs_node_free(write_node);
ipfs_node_free(read_node);
fclose(f1);
fclose(f2);
return 0;
}
} }
ipfs_repo_fsrepo_free(fs_repo); ipfs_repo_fsrepo_free(fs_repo);

View file

@ -1,4 +1,4 @@
#include "ipfs/node/node.h" #include "ipfs/merkledag/node.h"
int test_node() { int test_node() {
//Variables of link: //Variables of link: