Report Query Locking by Admin User¶
Report Query Locking by Admin User is a concurrency control mechanism used within the report download system to associate query execution tasks with a specific backend administrator.^[001-TODO__報表下載.md] This process ensures that resource-intensive report generation jobs can be tracked and managed by the user who initiated the request^[001-TODO__報表下載.md].
System Overview¶
The report generation workflow is asynchronous. When a user requests a report via the Gateway, the system returns a record identifier and proceeds to query data, subsequently storing the result in a GCP Cloud Storage bucket^[001-TODO__報表下載.md]. Once the file is generated, the system updates the record status, making the file available in the Report Download Center^[001-TODO__報表下載.md].
Implementation Details¶
Data Model¶
The system utilizes a database entity, FileDownloadRecordEntity, to persist the state and metadata of each download task^[001-TODO__報表下載.md]. This entity stores critical attributes required for locking and tracking, including:
- Report Source & Type: Identifies the origin and the specific enumeration of the report^[001-TODO__報表下載.md].
- Data Retrieval Key: An MD5 hash of the query conditions to uniquely identify the search parameters^[001-TODO__報表下載.md].
- Admin User ID: The specific backend user ID responsible for the query^[001-TODO__報表下載.md].
- Status: Tracks the current state of the job (e.g., processing, completed)^[001-TODO__報表下載.md].
- Timestamps: Records creation and completion times^[001-TODO__報表下載.md].
Locking Mechanism¶
The term "lock by backend userid" refers to the association of the FileDownloadRecordEntity with a specific adminId^[001-TODO__報表下載.md]. This binds the report generation process to the administrator's session or identity, likely facilitating access control and status auditing within the download center^[001-TODO__報表下載.md].
Related Concepts¶
- [[Asynchronous processing]]
- [[MD5 Hashing]]
- [[Google Cloud Storage]]
Sources¶
^[001-TODO__報表下載.md]