Added read status to obj

Signed-off-by: m.malygina <m.malygina@yadro.com>
add-delete-after-read
m.malygina 2024-06-06 12:16:01 +03:00
parent 20b2652823
commit 32dd94f453
1 changed files with 2 additions and 10 deletions

View File

@ -49,7 +49,7 @@ if (!!__ENV.METRIC_TAGS) {
const read_age = __ENV.READ_AGE ? parseInt(__ENV.READ_AGE) : 10;
let obj_to_read_selector = undefined;
if (registry_enabled) {
obj_to_read_selector = registry.getSelector( //registry.getLoopedSelector(
obj_to_read_selector = registry.getSelector(
__ENV.REGISTRY_FILE, 'obj_to_read',
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
status : 'created',
@ -168,8 +168,6 @@ export function obj_write() {
if (obj_registry) {
obj_registry.addObject('', '', bucket, key, payload.hash());
log.withFields({bucket : bucket, key : key})
.info("write successfully");
}
}
@ -188,9 +186,7 @@ export function obj_read() {
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, status: obj.status, op: `READ`})
.error(resp.error);
} else {
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, objid: obj.id, status: obj.status}).info("obj.info read successfully")
obj_registry.setObjectStatus(obj.id, obj.status, 'read');
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, objid: obj.id, status: obj.status}).info("obj.info read updated status successfully")
}
return
@ -202,8 +198,7 @@ export function obj_read() {
if (!resp.success) {
log.withFields({bucket : obj.bucket, key : obj.object}).error(resp.error);
} else {
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
.info("read successfully");
obj_registry.setObjectStatus(obj.id, obj.status, 'read');
}
}
@ -231,9 +226,6 @@ export function delete_object(obj) {
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'})
.error(resp.error);
return;
} else {
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
.info("deleted successfully");
}
obj_registry.deleteObject(obj.id);