mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-13 13:53:16 +00:00
Read earlier journal payload out of store
This commit is contained in:
parent
d213247927
commit
77198dd163
@ -1103,7 +1103,7 @@ enum rhizome_payload_status rhizome_open_read(struct rhizome_read *read, const r
|
||||
WHYF_perror("lseek64(%s,0,SEEK_END)", alloca_str_toprint(blob_path));
|
||||
if (read->length <= (uint64_t)pos){
|
||||
read->blob_fd = fd;
|
||||
DEBUGF(rhizome_store, "Opened stored file %s as fd %d, len %"PRIu64, blob_path, read->blob_fd, read->length);
|
||||
DEBUGF(rhizome_store, "Opened stored file %s as fd %d, len %"PRIu64" (%"PRIu64")", blob_path, read->blob_fd, read->length, pos);
|
||||
return RHIZOME_PAYLOAD_STATUS_STORED;
|
||||
}
|
||||
DEBUGF(rhizome_store, "Ignoring file? %s fd %d, len %"PRIu64", seek %zd", blob_path, fd, read->length, pos);
|
||||
@ -1135,8 +1135,11 @@ static ssize_t rhizome_read_retry(sqlite_retry_state *retry, struct rhizome_read
|
||||
{
|
||||
IN();
|
||||
if (read_state->blob_fd != -1) {
|
||||
assert(read_state->offset <= read_state->length);
|
||||
if (lseek64(read_state->blob_fd, (off64_t) read_state->offset, SEEK_SET) == -1)
|
||||
RETURN(WHYF_perror("lseek64(%d,%"PRIu64",SEEK_SET)", read_state->blob_fd, read_state->offset));
|
||||
if (bufsz + read_state->offset > read_state->length)
|
||||
bufsz = read_state->length - read_state->offset;
|
||||
if (bufsz == 0)
|
||||
RETURN(0);
|
||||
ssize_t rd = read(read_state->blob_fd, buffer, bufsz);
|
||||
|
@ -1084,6 +1084,7 @@ test_JournalAppendNoHash() {
|
||||
tfw_cat --stdout --stderr
|
||||
assert_stdout_add_file file1
|
||||
extract_stdout_manifestid BID
|
||||
extract_stdout_filehash HASH
|
||||
assert [ $(ls "$SERVALINSTANCE_PATH/hash" | wc -l) -eq 1 ]
|
||||
executeOk_servald rhizome journal append $SIDA $BID file2
|
||||
tfw_cat --stdout --stderr
|
||||
@ -1092,6 +1093,9 @@ test_JournalAppendNoHash() {
|
||||
executeOk_servald rhizome extract file $BID filex
|
||||
tfw_cat --stdout --stderr
|
||||
assert diff file filex
|
||||
executeOk_servald rhizome export file $HASH file1x
|
||||
tfw_cat --stdout --stderr
|
||||
assert diff file1 file1x
|
||||
}
|
||||
|
||||
doc_JournalAppendSharedPayload="Journal append produces a shared payload"
|
||||
|
Loading…
x
Reference in New Issue
Block a user