mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 21:27:57 +00:00
Document REST POST /restful/rhizome/insert
Adds definitions for Rhizome concepts such as Bundle ID, Bundle Secret, payload, etc. and a detailed step-by-step definition of the insertion logic.
This commit is contained in:
parent
3f8f0f6fc7
commit
bd45186a6a
File diff suppressed because it is too large
Load Diff
@ -478,6 +478,7 @@ static int insert_mime_part_header(struct http_request *hr, const struct mime_pa
|
||||
// Reject a request if this parameter comes after the manifest part.
|
||||
if (r->u.insert.received_manifest)
|
||||
return http_response_form_part(r, 400, "Spurious", PART_AUTHOR, NULL, 0);
|
||||
// TODO enforce correct content type
|
||||
r->u.insert.current_part = PART_AUTHOR;
|
||||
assert(r->u.insert.author_hex_len == 0);
|
||||
}
|
||||
@ -487,6 +488,7 @@ static int insert_mime_part_header(struct http_request *hr, const struct mime_pa
|
||||
// Reject a request if this parameter comes after the manifest part.
|
||||
if (r->u.insert.received_manifest)
|
||||
return http_response_form_part(r, 400, "Spurious", PART_SECRET, NULL, 0);
|
||||
// TODO enforce correct content type
|
||||
r->u.insert.current_part = PART_SECRET;
|
||||
assert(r->u.insert.secret_text_len == 0);
|
||||
}
|
||||
@ -496,6 +498,7 @@ static int insert_mime_part_header(struct http_request *hr, const struct mime_pa
|
||||
// Reject a request if this parameter comes after the manifest part.
|
||||
if (r->u.insert.received_manifest)
|
||||
return http_response_form_part(r, 400, "Spurious", PART_BUNDLEID, NULL, 0);
|
||||
// TODO enforce correct content type
|
||||
r->u.insert.current_part = PART_BUNDLEID;
|
||||
assert(r->u.insert.bid_text_len == 0);
|
||||
}
|
||||
@ -521,6 +524,7 @@ static int insert_mime_part_header(struct http_request *hr, const struct mime_pa
|
||||
if (!r->u.insert.received_manifest)
|
||||
return http_response_form_part(r, 400, "Missing", PART_MANIFEST, NULL, 0);
|
||||
assert(r->manifest != NULL);
|
||||
// TODO enforce correct content type
|
||||
r->u.insert.current_part = PART_PAYLOAD;
|
||||
// If the manifest does not contain a 'name' field, then assign it from the payload filename.
|
||||
if ( strcasecmp(RHIZOME_SERVICE_FILE, r->manifest->service) == 0
|
||||
|
@ -1637,8 +1637,10 @@ enum rhizome_payload_status rhizome_finish_store(struct rhizome_write *write, rh
|
||||
DEBUGF(rhizome, "m->filesize=%"PRIu64", write->file_length=%"PRIu64, m->filesize, write->file_length);
|
||||
return RHIZOME_PAYLOAD_STATUS_WRONG_SIZE;
|
||||
}
|
||||
if (m->is_journal)
|
||||
rhizome_manifest_set_version(m, m->filesize);
|
||||
if (m->is_journal) {
|
||||
// TODO ensure new version is greater than previous version
|
||||
rhizome_manifest_set_version(m, m->tail + m->filesize);
|
||||
}
|
||||
if (m->filesize) {
|
||||
if (m->is_journal || !m->has_filehash)
|
||||
rhizome_manifest_set_filehash(m, &write->id);
|
||||
|
Loading…
Reference in New Issue
Block a user