Folders: Reduce DB queries when counting and deleting resources under folders (#81153)
* Add folder store method for fetching all folder descendants * Modify GetDescendantCounts() to fetch folder descendants at once * Reduce DB calls when counting library panels under dashboard * Reduce DB calls when counting dashboards under folder * Reduce DB calls during folder delete * Modify folder registry to count/delete entities under multiple folders * Reduce DB calls when counting * Reduce DB calls when deleting
This commit is contained in:
@@ -23,8 +23,8 @@ type store interface {
|
||||
// Create creates a folder and returns the newly-created folder.
|
||||
Create(ctx context.Context, cmd folder.CreateFolderCommand) (*folder.Folder, error)
|
||||
|
||||
// Delete deletes a folder from the folder store.
|
||||
Delete(ctx context.Context, uid string, orgID int64) error
|
||||
// Delete folders with the specified UIDs and orgID from the folder store.
|
||||
Delete(ctx context.Context, UIDs []string, orgID int64) error
|
||||
|
||||
// Update updates the given folder's UID, Title, and Description (update mode).
|
||||
// If the NewParentUID field is not nil, it updates also the parent UID (move mode).
|
||||
@@ -48,4 +48,6 @@ type store interface {
|
||||
|
||||
// GetFolders returns folders with given uids
|
||||
GetFolders(ctx context.Context, q getFoldersQuery) ([]*folder.Folder, error)
|
||||
// GetDescendants returns all descendants of a folder
|
||||
GetDescendants(ctx context.Context, orgID int64, anchestor_uid string) ([]*folder.Folder, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user