【发布时间】:2020-03-12 06:50:48
【问题描述】:
我的问题是关于“通用”等命名的含义。
我正在看 GCP 的云功能教程, https://cloud.google.com/functions/docs/tutorials/storage#object_finalize
本教程有一个简单的例子。
/**
* 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 等编程语言。
这个问题听起来很傻,但英语不是我的母语,我还是想大致了解一下这个命名上下文。
提前致谢!
【问题讨论】:
标签: google-cloud-functions google-cloud-storage naming