- Disable profiling output for now. It can be turned on again later.
- Allow destination directory for backup files to be specified on the
command-line (but we should add proper command-line parsing later).
- More work to track inter-object references, but not yet finished.
PACKAGES=uuid
-CXXFLAGS=-O -Wall -D_FILE_OFFSET_BITS=64 -g -pg \
+DEBUG=-g #-pg
+CXXFLAGS=-O -Wall -D_FILE_OFFSET_BITS=64 $(DEBUG) \
`pkg-config --cflags $(PACKAGES)`
-LDFLAGS=-g -pg -ltar `pkg-config --libs $(PACKAGES)`
+LDFLAGS=$(DEBUG) -ltar `pkg-config --libs $(PACKAGES)`
SRCS=format.cc scandir.cc sha1.cc store.cc
OBJS=$(SRCS:.cc=.o)
{
block_buf = new char[LBS_BLOCK_SIZE];
- tss = new TarSegmentStore(".");
+ if (argc > 1) {
+ tss = new TarSegmentStore(argv[1]);
+ } else {
+ tss = new TarSegmentStore(".");
+ }
std::ostringstream metadata;
{
uint8_t resbuf[20];
char hexbuf[4];
- string result = "sha-1:";
+ string result = "sha1=";
sha1_finish_ctx(&ctx, resbuf);
void LbsObject::add_reference(const LbsObject *o)
{
- // TODO: Implement
+ refs.insert(o->get_name());
}
void LbsObject::write(TarSegmentStore *store)
assert(data != NULL);
assert(!written);
- name = store->write_object(data, data_len, group);
+ list<string> reflist;
+ for (set<string>::iterator i = refs.begin(); i != refs.end(); ++i) {
+ reflist.push_back(*i);
+ }
+
+ name = store->write_object(data, data_len, group, reflist);
written = true;
data = NULL;
bool written;
std::string name;
+
+ std::set<std::string> refs;
};
#endif // _LBS_TARSTORE_H