From 885e633ba201da6f0883c0c8cf0056613c32eed3 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Mon, 1 Aug 2022 18:17:31 +0200 Subject: [PATCH] Improve (cue) codegen performance --- automation/session.cue | 2 +- automation/trigger.cue | 2 +- automation/workflow.cue | 2 +- compose/attachment.cue | 2 +- compose/chart.cue | 2 +- compose/module-field.cue | 2 +- compose/module.cue | 2 +- compose/namespace.cue | 2 +- compose/page.cue | 2 +- compose/record.cue | 2 +- federation/module-exposed.cue | 2 +- federation/module-mapping.cue | 6 +--- federation/node-sync.cue | 2 +- federation/node.cue | 3 +- federation/shared-module.cue | 2 +- system/apigw_filter.cue | 2 +- system/apigw_route.cue | 2 +- system/application.cue | 2 +- system/attachment.cue | 2 +- system/auth_client.cue | 2 +- system/auth_confirmed_client.cue | 2 +- system/auth_oa2token.cue | 2 +- system/auth_session.cue | 2 +- system/component.cue | 46 ++++++++++++------------- system/credential.cue | 2 +- system/dal_connection.cue | 2 +- system/dal_sensitivity_level.cue | 4 +-- system/data_privacy_request.cue | 2 +- system/data_privacy_request_comment.cue | 4 +-- system/queue.cue | 2 +- system/queue_message.cue | 4 +-- system/reminder.cue | 2 +- system/report.cue | 2 +- system/resource_translation.cue | 2 +- system/role.cue | 2 +- system/role_member.cue | 6 +--- system/settings.cue | 2 +- system/template.cue | 2 +- system/user.cue | 2 +- 39 files changed, 61 insertions(+), 76 deletions(-) diff --git a/automation/session.cue b/automation/session.cue index 95c079de7..c2bb7e7c2 100644 --- a/automation/session.cue +++ b/automation/session.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -session: schema.#Resource & { +session: { features: { labels: false } diff --git a/automation/trigger.cue b/automation/trigger.cue index ff2bdc0a6..627857044 100644 --- a/automation/trigger.cue +++ b/automation/trigger.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -trigger: schema.#Resource & { +trigger: { struct: { id: schema.IdField workflow_id: { sortable: true, ident: "workflowID", goType: "uint64", storeIdent: "rel_workflow" } diff --git a/automation/workflow.cue b/automation/workflow.cue index c35e947c4..cc7d232e7 100644 --- a/automation/workflow.cue +++ b/automation/workflow.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -workflow: schema.#Resource & { +workflow: { struct: { id: schema.IdField handle: schema.HandleField diff --git a/compose/attachment.cue b/compose/attachment.cue index 29541cb9b..c1f07d7cd 100644 --- a/compose/attachment.cue +++ b/compose/attachment.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -attachment: schema.#Resource & { +attachment: { features: { labels: false } diff --git a/compose/chart.cue b/compose/chart.cue index 2560f81b7..68b22fd7f 100644 --- a/compose/chart.cue +++ b/compose/chart.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -chart: schema.#Resource & { +chart: { parents: [ {handle: "namespace"}, ] diff --git a/compose/module-field.cue b/compose/module-field.cue index 8cd78bbde..f78d1193f 100644 --- a/compose/module-field.cue +++ b/compose/module-field.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -moduleField: schema.#Resource & { +moduleField: { parents: [ {handle: "namespace"}, {handle: "module"}, diff --git a/compose/module.cue b/compose/module.cue index 254467b03..df577c9ba 100644 --- a/compose/module.cue +++ b/compose/module.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -module: schema.#Resource & { +module: { handle: "module" parents: [ {handle: "namespace"}, diff --git a/compose/namespace.cue b/compose/namespace.cue index 9fd30c9a9..de8d1ba9e 100644 --- a/compose/namespace.cue +++ b/compose/namespace.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -namespace: schema.#Resource & { +namespace: { struct: { id: schema.IdField slug: { sortable: true, goType: "string" } diff --git a/compose/page.cue b/compose/page.cue index 81fc6cf2f..10d8f4982 100644 --- a/compose/page.cue +++ b/compose/page.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -page: schema.#Resource & { +page: { parents: [ {handle: "namespace"}, ] diff --git a/compose/record.cue b/compose/record.cue index c20988922..9ae9208f4 100644 --- a/compose/record.cue +++ b/compose/record.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -record: schema.#Resource & { +record: { parents: [ {handle: "namespace"}, {handle: "module"}, diff --git a/federation/module-exposed.cue b/federation/module-exposed.cue index 5a6b34a1b..215aad812 100644 --- a/federation/module-exposed.cue +++ b/federation/module-exposed.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -exposedModule: schema.#Resource & { +exposedModule: { parents: [ {handle: "node"}, ] diff --git a/federation/module-mapping.cue b/federation/module-mapping.cue index a4d42ee0b..02ae7b336 100644 --- a/federation/module-mapping.cue +++ b/federation/module-mapping.cue @@ -1,10 +1,6 @@ package federation -import ( - "github.com/cortezaproject/corteza-server/codegen/schema" -) - -moduleMapping: schema.#Resource & { +moduleMapping: { parents: [ {handle: "node"}, ] diff --git a/federation/node-sync.cue b/federation/node-sync.cue index 15a1074b3..1ed58e7f7 100644 --- a/federation/node-sync.cue +++ b/federation/node-sync.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -nodeSync: schema.#Resource & { +nodeSync: { features: { labels: false } diff --git a/federation/node.cue b/federation/node.cue index 9bbf4b1a9..8a6d73efa 100644 --- a/federation/node.cue +++ b/federation/node.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -node: schema.#Resource & { +node: { features: { labels: false paging: false @@ -38,7 +38,6 @@ node: schema.#Resource & { } query: ["name", "base_url"] - byQuery: ["status"] byNilState: ["deleted"] } diff --git a/federation/shared-module.cue b/federation/shared-module.cue index 63f26720a..15b326125 100644 --- a/federation/shared-module.cue +++ b/federation/shared-module.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -sharedModule: schema.#Resource & { +sharedModule: { features: { labels: false } diff --git a/system/apigw_filter.cue b/system/apigw_filter.cue index 5d90eefe2..d6e627914 100644 --- a/system/apigw_filter.cue +++ b/system/apigw_filter.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -apigw_filter: schema.#Resource & { +apigw_filter: { features: { labels: false } diff --git a/system/apigw_route.cue b/system/apigw_route.cue index 00b4686a5..a0dfb9662 100644 --- a/system/apigw_route.cue +++ b/system/apigw_route.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -apigw_route: schema.#Resource & { +apigw_route: { features: { labels: false } diff --git a/system/application.cue b/system/application.cue index 2d4bf42be..5d9ce27c1 100644 --- a/system/application.cue +++ b/system/application.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -application: schema.#Resource & { +application: { struct: { id: schema.IdField name: {sortable: true} diff --git a/system/attachment.cue b/system/attachment.cue index 9eeb79c4c..5fb05b8d8 100644 --- a/system/attachment.cue +++ b/system/attachment.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -attachment: schema.#Resource & { +attachment: { features: { labels: false } diff --git a/system/auth_client.cue b/system/auth_client.cue index 2747f0b65..7aaded9c4 100644 --- a/system/auth_client.cue +++ b/system/auth_client.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -auth_client: schema.#Resource & { +auth_client: { struct: { id: schema.IdField handle: schema.HandleField diff --git a/system/auth_confirmed_client.cue b/system/auth_confirmed_client.cue index 62bbe149e..c1cdfb7b0 100644 --- a/system/auth_confirmed_client.cue +++ b/system/auth_confirmed_client.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -auth_confirmed_client: schema.#Resource & { +auth_confirmed_client: { features: { labels: false paging: false diff --git a/system/auth_oa2token.cue b/system/auth_oa2token.cue index 4e6de5332..89e294619 100644 --- a/system/auth_oa2token.cue +++ b/system/auth_oa2token.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -auth_oa2token: schema.#Resource & { +auth_oa2token: { features: { labels: false paging: false diff --git a/system/auth_session.cue b/system/auth_session.cue index 10e60adc7..3898507c7 100644 --- a/system/auth_session.cue +++ b/system/auth_session.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -auth_session: schema.#Resource & { +auth_session: { features: { labels: false paging: false diff --git a/system/component.cue b/system/component.cue index 2f17dd6a8..52a3ec622 100644 --- a/system/component.cue +++ b/system/component.cue @@ -8,29 +8,29 @@ component: schema.#component & { handle: "system" resources: { - "attachment": attachment - "application": application - "apigw-route": apigw_route - "apigw-filter": apigw_filter - "auth-client": auth_client - "auth-confirmed-client": auth_confirmed_client - "auth-session": auth_session - "auth-oa2token": auth_oa2token - "credential": credential - "data-privacy-request": data_privacy_request - "data-privacy-request_comment": data_privacy_request_comment - "queue": queue - "queue_message": queue_message - "reminder": reminder - "report": report - "resource-translation": resource_translation - "role": role - "role_member": role_member - "settings": settings - "template": template - "user": user - "dal-connection": dal_connection - "dal-sensitivity-level": dal_sensitivity_level + "attachment": attachment + "application": application + "apigw-route": apigw_route + "apigw-filter": apigw_filter + "auth-client": auth_client + "auth-confirmed-client": auth_confirmed_client + "auth-session": auth_session + "auth-oa2token": auth_oa2token + "credential": credential + "data-privacy-request": data_privacy_request + "data-privacy-request-comment": data_privacy_request_comment + "queue": queue + "queue_message": queue_message + "reminder": reminder + "report": report + "resource-translation": resource_translation + "role": role + "role_member": role_member + "settings": settings + "template": template + "user": user + "dal-connection": dal_connection + "dal-sensitivity-level": dal_sensitivity_level } rbac: operations: { diff --git a/system/credential.cue b/system/credential.cue index 5af593ef7..21a3a268e 100644 --- a/system/credential.cue +++ b/system/credential.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -credential: schema.#Resource & { +credential: { struct: { id: schema.IdField owner_id: { goType: "uint64", ident: "ownerID", storeIdent: "rel_owner" } diff --git a/system/dal_connection.cue b/system/dal_connection.cue index c28fd96ad..8462e8200 100644 --- a/system/dal_connection.cue +++ b/system/dal_connection.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -dal_connection: schema.#Resource & { +dal_connection: { struct: { id: schema.IdField name: { sortable: true, goType: "string" } diff --git a/system/dal_sensitivity_level.cue b/system/dal_sensitivity_level.cue index 0643bb4ed..83bb2b0ef 100644 --- a/system/dal_sensitivity_level.cue +++ b/system/dal_sensitivity_level.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -dal_sensitivity_level: schema.#Resource & { +dal_sensitivity_level: { struct: { id: schema.IdField handle: schema.HandleField @@ -30,8 +30,6 @@ dal_sensitivity_level: schema.#Resource & { byNilState: ["deleted"] } - rbac: false - features: { labels: false paging: false diff --git a/system/data_privacy_request.cue b/system/data_privacy_request.cue index 6f17aba29..b3626fcfb 100644 --- a/system/data_privacy_request.cue +++ b/system/data_privacy_request.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -data_privacy_request: schema.#Resource & { +data_privacy_request: { features: { labels: false } diff --git a/system/data_privacy_request_comment.cue b/system/data_privacy_request_comment.cue index fe5da89b2..7fe66de7d 100644 --- a/system/data_privacy_request_comment.cue +++ b/system/data_privacy_request_comment.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -data_privacy_request_comment: schema.#Resource & { +data_privacy_request_comment: { features: { labels: false } @@ -31,8 +31,6 @@ data_privacy_request_comment: schema.#Resource & { byValue: ["request_id"] } - rbac: false - store: { api: { functions: [] diff --git a/system/queue.cue b/system/queue.cue index 6c00f1f42..e69ee9d8e 100644 --- a/system/queue.cue +++ b/system/queue.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -queue: schema.#Resource & { +queue: { features: { labels: false } diff --git a/system/queue_message.cue b/system/queue_message.cue index 9cb31d86c..ea260ff66 100644 --- a/system/queue_message.cue +++ b/system/queue_message.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -queue_message: schema.#Resource & { +queue_message: { features: { labels: false checkFn: false @@ -28,8 +28,6 @@ queue_message: schema.#Resource & { byNilState: ["processed"] } - rbac: false - store: { api: { lookups: [] diff --git a/system/reminder.cue b/system/reminder.cue index 53cbc3ed7..254edd4a1 100644 --- a/system/reminder.cue +++ b/system/reminder.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -reminder: schema.#Resource & { +reminder: { features: { labels: false } diff --git a/system/report.cue b/system/report.cue index 5f1b32ccf..2ad2b873a 100644 --- a/system/report.cue +++ b/system/report.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -report: schema.#Resource & { +report: { struct: { id: schema.IdField handle: schema.HandleField diff --git a/system/resource_translation.cue b/system/resource_translation.cue index f82616bd9..72812072c 100644 --- a/system/resource_translation.cue +++ b/system/resource_translation.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -resource_translation: schema.#Resource & { +resource_translation: { features: { labels: false checkFn: false diff --git a/system/role.cue b/system/role.cue index 2dc3c1e85..8a60855b4 100644 --- a/system/role.cue +++ b/system/role.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -role: schema.#Resource & { +role: { struct: { id: schema.IdField name: {sortable: true} diff --git a/system/role_member.cue b/system/role_member.cue index a7720f153..fb380af1c 100644 --- a/system/role_member.cue +++ b/system/role_member.cue @@ -1,10 +1,6 @@ package system -import ( - "github.com/cortezaproject/corteza-server/codegen/schema" -) - -role_member: schema.#Resource & { +role_member: { features: { labels: false paging: false diff --git a/system/settings.cue b/system/settings.cue index 8da9e0e0f..5cdb6422c 100644 --- a/system/settings.cue +++ b/system/settings.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -settings: schema.#Resource & { +settings: { ident: "settingValue" expIdent: "SettingValue" diff --git a/system/template.cue b/system/template.cue index 167b4c537..7e17c920e 100644 --- a/system/template.cue +++ b/system/template.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -template: schema.#Resource & { +template: { struct: { id: schema.IdField handle: schema.HandleField diff --git a/system/user.cue b/system/user.cue index 44c1f9997..6413870ca 100644 --- a/system/user.cue +++ b/system/user.cue @@ -4,7 +4,7 @@ import ( "github.com/cortezaproject/corteza-server/codegen/schema" ) -user: schema.#Resource & { +user: { struct: { id: schema.IdField handle: schema.HandleField