我的问题是关于“通用”这样的命名。
我正在浏览GCP的云功能教程, documentation
本教程中有一个简单的示例。
/**
* Generic background Cloud Function to be triggered by Cloud Storage.
*
* @param {object} event The Cloud Functions event.
* @param {function} callback The callback function.
*/
exports.helloGCSGeneric = (data,context,callback) => {
const file = data;
console.log(` Event: ${context.eventId}`);
console.log(` Event Type: ${context.eventType}`);
console.log(` Bucket: ${file.bucket}`);
console.log(` File: ${file.name}`);
console.log(` Metageneration: ${file.metageneration}`);
console.log(` Created: ${file.timeCreated}`);
console.log(` Updated: ${file.updated}`);
callback();
};
即使对于我来说,此功能的作用也很容易。 在我的理解中,对象创建/更新完成时会触发该事件。
'helloGCSFinalization'或'helloGCSGeneration'很有意义,但是为什么将其命名为'Generic'? 在哪种情况下使用“通用”?我认为与C ++或Java等编程语言不同。
这个问题听起来很愚蠢,但是英语不是我的母语,我仍然想对这种命名环境有个全面了解。
谢谢!