Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ json_t* make_collection_timestamp(const char *key,

json_t* make_replicate(const char *resource,
const char *location,
const char *phys_path,
const char *checksum,
const char *replicate,
const char *status,
Expand Down Expand Up @@ -847,10 +848,13 @@ json_t* make_replicate(const char *resource,
ck_value = json_null();
}

result = json_pack("{s:s, s:s, s:o, s:i, s:o}", JSON_RESOURCE_KEY, resource,
JSON_LOCATION_KEY, location, JSON_CHECKSUM_KEY, ck_value,
JSON_REPLICATE_NUMBER_KEY, repl, JSON_REPLICATE_STATUS_KEY,
is_valid);
result = json_pack("{s:s, s:s, s:s, s:o, s:i, s:o}",
JSON_RESOURCE_KEY, resource,
JSON_LOCATION_KEY, location,
JSON_PHYSICAL_PATH_KEY, phys_path,
JSON_CHECKSUM_KEY, ck_value,
JSON_REPLICATE_NUMBER_KEY, repl,
JSON_REPLICATE_STATUS_KEY, is_valid);

if (!result) {
set_baton_error(error, -1, "Failed to pack replicate object");
Expand Down
2 changes: 2 additions & 0 deletions src/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#define JSON_DATA_OBJECT_KEY "data_object"
#define JSON_DATA_OBJECT_SHORT_KEY "obj"
#define JSON_DATA_KEY "data"
#define JSON_PHYSICAL_PATH_KEY "physical_path"

#define JSON_CONTENTS_KEY "contents"
#define JSON_SIZE_KEY "size"
Expand Down Expand Up @@ -365,6 +366,7 @@ json_t* make_collection_timestamp(const char *key,

json_t* make_replicate(const char *resource,
const char *location,
const char *phys_path,
const char *checksum,
const char *replicate,
const char *status,
Expand Down
17 changes: 11 additions & 6 deletions src/json_query.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2013, 2014, 2015, 2016, 2019, 2021, 2023, 2025 Genome
* Copyright (C) 2013, 2014, 2015, 2016, 2019, 2021, 2023, 2025, 2026 Genome
* Research Ltd. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -1366,16 +1366,21 @@ json_t* revmap_replicate_results(rcComm_t *conn,
json_string_value(resc); const char *location = json_string_value(loc);
#endif

const json_t *path = json_object_get(result, JSON_PHYSICAL_PATH_KEY);
const json_t *chk = json_object_get(result, JSON_CHECKSUM_KEY);
const json_t *num = json_object_get(result, JSON_REPLICATE_NUMBER_KEY);
const json_t *stat = json_object_get(result, JSON_REPLICATE_STATUS_KEY);

const char *checksum = json_string_value(chk);
const char *number = json_string_value(num);
const char *status = json_string_value(stat);
const char *phys_path = json_string_value(path);
const char *checksum = json_string_value(chk);
const char *number = json_string_value(num);
const char *status = json_string_value(stat);

json_t *replicate = make_replicate(resource, location, checksum, number, status,
error);
logmsg(DEBUG, "Mapped replicate %s of '%s' to '%s' at '%s'", number,
phys_path, resource, location);

json_t *replicate = make_replicate(resource, location, phys_path, checksum,
number, status, error);

#if IRODS_VERSION_INTEGER && IRODS_VERSION_INTEGER >= 4001008
if (resource_info) json_decref(resource_info);
Expand Down
8 changes: 5 additions & 3 deletions src/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,20 +503,22 @@ json_t* list_replicates(rcComm_t *conn, rodsPath_t *rods_path, baton_error_t *er

#if IRODS_VERSION_INTEGER && IRODS_VERSION_INTEGER >= 4001008
query_format_in_t obj_format = {
.num_columns = 5,
.num_columns = 6,
.columns = {
COL_D_REPL_STATUS,
COL_DATA_REPL_NUM,
COL_D_DATA_CHECKSUM,
COL_COLL_NAME,
COL_D_RESC_HIER
COL_D_RESC_HIER,
COL_D_DATA_PATH
},
.labels = {
JSON_REPLICATE_STATUS_KEY,
JSON_REPLICATE_NUMBER_KEY,
JSON_CHECKSUM_KEY,
JSON_COLLECTION_KEY,
JSON_RESOURCE_HIER_KEY
JSON_RESOURCE_HIER_KEY,
JSON_PHYSICAL_PATH_KEY
}
};
#else
Expand Down
2 changes: 1 addition & 1 deletion src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ query_format_in_t* make_query_format_from_sql(const char *sql) {
return format;

error_recoverable:
logmsg(ERROR, "Could not parse select columns from SQL " "into query format: '%s'",
logmsg(ERROR, "Could not parse select columns from SQL into query format: '%s'",
sql);
goto error;

Expand Down
10 changes: 8 additions & 2 deletions tests/check_baton.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,11 +982,17 @@ START_TEST(test_list_replicates_obj) {
json_t *result;
json_array_foreach(results, index, result) {
ck_assert(json_is_object(result));
// We don't know the physical path on the iRODS server
ck_assert(json_object_get(result, JSON_PHYSICAL_PATH_KEY));
// Remove it once tested so that we can easily check the other values together.

if (json_object_get(result, JSON_PHYSICAL_PATH_KEY)) {
json_object_del(result, JSON_PHYSICAL_PATH_KEY);
}
// We don't know what the location value will be for a test
// run because it's an iRODS resource server hostname.
ck_assert(json_object_get(result, JSON_LOCATION_KEY));
// Remove it once tested so that we can easily check the other
// values together.
// Remove it once tested so that we can easily check the other values together.
if (json_object_get(result, JSON_LOCATION_KEY)) {
json_object_del(result, JSON_LOCATION_KEY);
}
Expand Down