Skip to content

Commit

Permalink
CR changes
Browse files Browse the repository at this point in the history
Signed-off-by: shirady <[email protected]>
  • Loading branch information
shirady committed Nov 14, 2024
1 parent 210071f commit 80a0e2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/sdk/bucketspace_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ class BucketSpaceFS extends BucketSpaceSimpleFS {
}

/**
* stat_bucket will return the stat output on bucket config file
* @param {string} bucket_name
* @returns {Promise<nb.NativeFSStats>}
*/
async stat_bucket(bucket_name) {
if (config.ALLOW_BUCKET_NS_CACHE_STAT) {
Expand Down
15 changes: 7 additions & 8 deletions src/sdk/object_sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,19 @@ class ObjectSDK {
// stat check (only in bucketspace FS)
const ns_allow_stat_bucket = Boolean(this._get_bucketspace().stat_bucket);
if (ns_allow_stat_bucket) {
let current_stat;
try {
current_stat = await this._get_bucketspace().stat_bucket(params.name);
const current_stat = await this._get_bucketspace().stat_bucket(params.name);
if (current_stat) {
const same_stat = current_stat.ino === data.stat.ino && current_stat.mtimeNsBigint === data.stat.mtimeNsBigint;
if (!same_stat) { // config file of bucket was changed
return false;
}
}
} catch (err) {
// originally this part was added in case a bucket is created and then deleted
// and we would get ENOENT, but decide that on any error we will not use the stat
dbg.log4('_validate_bucket_namespace got an error', err, 'ignoring...');
}
if (current_stat) {
const same_stat = current_stat.ino === data.stat.ino && current_stat.mtimeNsBigint === data.stat.mtimeNsBigint;
if (!same_stat) { // config file of bucket was changed
return false;
}
}
}
if (time <= data.valid_until) return true;
const bucket = await this._get_bucketspace().read_bucket_sdk_info({ name: params.name });
Expand Down

0 comments on commit 80a0e2c

Please sign in to comment.