Compare commits
1 commit
master
...
feauture-a
Author | SHA1 | Date | |
---|---|---|---|
858725546e |
2 changed files with 9 additions and 4 deletions
|
@ -32,6 +32,7 @@ func NewObjSelector(registry *ObjRegistry, selectionSize int, kind SelectorKind,
|
|||
if selectionSize <= 0 {
|
||||
selectionSize = objectSelectCache
|
||||
}
|
||||
println("selectionSize", selectionSize)
|
||||
if filter == nil || filter.Status == "" {
|
||||
panic("filtering without status is not supported")
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ if (registry_enabled && delete_age) {
|
|||
obj_to_delete_selector =
|
||||
constructor(__ENV.REGISTRY_FILE, 'obj_to_delete',
|
||||
__ENV.SELECTION_SIZE ? parseInt(__ENV.SELECTION_SIZE) : 0, {
|
||||
status : 'created',
|
||||
status : 'read',
|
||||
age : delete_age,
|
||||
});
|
||||
}
|
||||
|
@ -160,11 +160,11 @@ export function obj_write() {
|
|||
|
||||
const payload = generator.genPayload();
|
||||
const resp = s3_client.put(bucket, key, payload);
|
||||
log.withFields({bucket : bucket, key : key, op : 'WRITE'}).info("INFO");
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : bucket, key : key}).error(resp.error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj_registry) {
|
||||
obj_registry.addObject('', '', bucket, key, payload.hash());
|
||||
}
|
||||
|
@ -181,9 +181,12 @@ export function obj_read() {
|
|||
return;
|
||||
}
|
||||
const resp = s3_client.get(obj.s3_bucket, obj.s3_key)
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'READ'}).info("INFO")
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key})
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'READ'})
|
||||
.error(resp.error);
|
||||
} else {
|
||||
obj_registry.setObjectStatus(obj.id, obj.status, 'read');
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -208,7 +211,8 @@ export function obj_delete() {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
obj_registry.setObjectStatus(obj.id, obj.status, 'delete');
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'}).info("INFO");
|
||||
const resp = s3_client.delete(obj.s3_bucket, obj.s3_key);
|
||||
if (!resp.success) {
|
||||
log.withFields({bucket : obj.s3_bucket, key : obj.s3_key, op : 'DELETE'})
|
||||
|
|
Loading…
Reference in a new issue