mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-20 09:26:37 +00:00
Replace config 'rhizome.external_blobs' with 'rhizome.max_blob_size'
This commit is contained in:
parent
0c88f8bf89
commit
34188fa489
3
conf.h
3
conf.h
@ -657,6 +657,9 @@ int cf_fmt_int32_nonneg(const char **, const int32_t *intp);
|
||||
int cf_opt_uint32_nonzero(uint32_t *intp, const char *text);
|
||||
int cf_fmt_uint32_nonzero(const char **, const uint32_t *intp);
|
||||
|
||||
int cf_opt_uint32_scaled(uint32_t *intp, const char *text);
|
||||
int cf_fmt_uint32_scaled(const char **, const uint32_t *intp);
|
||||
|
||||
int cf_opt_uint64_scaled(uint64_t *intp, const char *text);
|
||||
int cf_fmt_uint64_scaled(const char **, const uint64_t *intp);
|
||||
|
||||
|
@ -428,6 +428,30 @@ int cf_cmp_uint32_time_interval(const uint32_t *a, const uint32_t *b)
|
||||
return cf_cmp_uint32(a, b);
|
||||
}
|
||||
|
||||
int cf_opt_uint32_scaled(uint32_t *intp, const char *text)
|
||||
{
|
||||
uint32_t result;
|
||||
const char *end;
|
||||
if (!str_to_uint32_scaled(text, 10, &result, &end) || *end)
|
||||
return CFINVALID;
|
||||
*intp = result;
|
||||
return CFOK;
|
||||
}
|
||||
|
||||
int cf_fmt_uint32_scaled(const char **textp, const uint32_t *uintp)
|
||||
{
|
||||
char buf[25];
|
||||
int n = uint32_scaled_to_str(buf, sizeof buf, *uintp);
|
||||
assert(n != 0);
|
||||
*textp = str_edup(buf);
|
||||
return CFOK;
|
||||
}
|
||||
|
||||
int cf_cmp_uint32_scaled(const uint32_t *a, const uint32_t *b)
|
||||
{
|
||||
return *a < *b ? -1 : *a > *b ? 1 : 0;
|
||||
}
|
||||
|
||||
int cf_opt_uint64_scaled(uint64_t *intp, const char *text)
|
||||
{
|
||||
uint64_t result;
|
||||
|
@ -426,7 +426,7 @@ ATOM(bool_t, clean_on_open, 0, boolean,, "If true, Rhizome datab
|
||||
ATOM(bool_t, clean_on_start, 1, boolean,, "If true, Rhizome database is cleaned at start of daemon")
|
||||
STRING(256, datastore_path, "", absolute_path,, "Path of rhizome storage directory, absolute or relative to instance directory")
|
||||
ATOM(uint64_t, database_size, 1000000, uint64_scaled,, "Size of database in bytes")
|
||||
ATOM(bool_t, external_blobs, 0, boolean,, "Store rhizome bundles as separate files.")
|
||||
ATOM(uint32_t, max_blob_size, 128 * 1024, uint32_scaled,, "Store payloads larger than this in files not SQLite blobs")
|
||||
|
||||
ATOM(uint64_t, rhizome_mdp_block_size, 512, uint64_scaled,, "Rhizome MDP block size.")
|
||||
ATOM(uint64_t, idle_timeout, RHIZOME_IDLE_TIMEOUT, uint64_scaled,, "Rhizome transfer timeout if no data received.")
|
||||
|
@ -86,7 +86,7 @@ enum rhizome_payload_status rhizome_open_write(struct rhizome_write *write, cons
|
||||
|
||||
char blob_path[1024];
|
||||
|
||||
if (config.rhizome.external_blobs || file_length > 128*1024) {
|
||||
if (file_length > config.rhizome.max_blob_size) {
|
||||
if (!FORM_RHIZOME_DATASTORE_PATH(blob_path, "%"PRId64, write->temp_id)){
|
||||
WHY("Invalid path");
|
||||
goto insert_row_fail;
|
||||
|
3
str.h
3
str.h
@ -410,6 +410,8 @@ int str_to_uint64(const char *str, int base, uint64_t *result, const char **afte
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
int str_to_int32_scaled(const char *str, int base, int32_t *result, const char **afterp);
|
||||
int str_to_uint32_scaled(const char *str, int base, uint32_t *result, const char **afterp);
|
||||
int str_to_int64_scaled(const char *str, int base, int64_t *result, const char **afterp);
|
||||
int str_to_uint64_scaled(const char *str, int base, uint64_t *result, const char **afterp);
|
||||
uint64_t scale_factor(const char *str, const char **afterp);
|
||||
@ -423,6 +425,7 @@ uint64_t scale_factor(const char *str, const char **afterp);
|
||||
*
|
||||
* @author Andrew Bettison <andrew@servalproject.com>
|
||||
*/
|
||||
int uint32_scaled_to_str(char *str, size_t len, uint32_t value);
|
||||
int uint64_scaled_to_str(char *str, size_t len, uint64_t value);
|
||||
|
||||
/* Parse a string as a time interval (seconds) in millisecond resolution. Return the number of
|
||||
|
@ -282,11 +282,11 @@ doc_ExtractManifestFileFromExtBlob="Export bundle from external blob"
|
||||
setup_ExtractManifestFileFromExtBlob() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
executeOk_servald config set rhizome.external_blobs 1
|
||||
executeOk_servald config set rhizome.max_blob_size 0
|
||||
echo "A test file" >file1
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
extract_stdout_rowid rowid1
|
||||
executeOk_servald config set rhizome.external_blobs 0
|
||||
executeOk_servald config set rhizome.max_blob_size 1000
|
||||
echo "Another test file" >file2
|
||||
executeOk_servald rhizome add file $SIDB1 file2 file2.manifest
|
||||
extract_stdout_rowid rowid2
|
||||
@ -352,7 +352,7 @@ doc_CorruptExternalBlob="A corrupted payload should fail to export"
|
||||
setup_CorruptExternalBlob() {
|
||||
setup_servald
|
||||
setup_rhizome
|
||||
executeOk_servald config set rhizome.external_blobs 1
|
||||
executeOk_servald config set rhizome.max_blob_size 0
|
||||
echo "A test file" >file1
|
||||
executeOk_servald rhizome add file $SIDB1 file1 file1.manifest
|
||||
extract_manifest_id manifestid file1.manifest
|
||||
|
@ -326,7 +326,7 @@ setup_FileTransferBigMDPExtBlob() {
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config \
|
||||
set rhizome.http.enable 0 \
|
||||
set rhizome.external_blobs 1 \
|
||||
set rhizome.max_blob_size 0 \
|
||||
set debug.externalblobs 1
|
||||
setup_bigfile_common
|
||||
}
|
||||
@ -340,7 +340,7 @@ setup_FileTransferBigHTTPExtBlob() {
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config \
|
||||
set rhizome.mdp.enable 0 \
|
||||
set rhizome.external_blobs 1 \
|
||||
set rhizome.max_blob_size 0 \
|
||||
set debug.externalblobs 1
|
||||
setup_bigfile_common
|
||||
}
|
||||
@ -402,7 +402,7 @@ setup_FileTransferMultiMDPExtBlob() {
|
||||
foreach_instance +A +B +C +D +E \
|
||||
executeOk_servald config \
|
||||
set rhizome.http.enable 0 \
|
||||
set rhizome.external_blobs 1 \
|
||||
set rhizome.max_blob_size 0 \
|
||||
set debug.externalblobs 1
|
||||
setup_multitransfer_common
|
||||
}
|
||||
@ -416,7 +416,7 @@ setup_FileTransferMultiHTTPExtBlob() {
|
||||
foreach_instance +A +B +C +D +E \
|
||||
executeOk_servald config \
|
||||
set rhizome.mdp.enable 0 \
|
||||
set rhizome.external_blobs 1 \
|
||||
set rhizome.max_blob_size 0 \
|
||||
set debug.externalblobs 1
|
||||
setup_multitransfer_common
|
||||
}
|
||||
@ -449,7 +449,7 @@ doc_CorruptPayload="A corrupted payload should be re-fetched"
|
||||
setup_CorruptPayload() {
|
||||
setup_common
|
||||
set_instance +A
|
||||
executeOk_servald config set rhizome.external_blobs 1
|
||||
executeOk_servald config set rhizome.max_blob_size 0
|
||||
rhizome_add_file file1 1024
|
||||
create_file file2 1024
|
||||
start_servald_instances +A +B
|
||||
|
Loading…
x
Reference in New Issue
Block a user