eye-gu commented on code in PR #3371:
URL: https://github.com/apache/dubbo-go/pull/3371#discussion_r3367378479


##########
metadata/report/nacos/report.go:
##########
@@ -214,6 +214,70 @@ func (n *nacosMetadataReport) 
RemoveServiceAppMappingListener(key string, group
        return n.removeServiceMappingListener(key, group)
 }
 
+// UnPublishAppMetadata removes metadata for a specific revision from nacos.
+// This operation is idempotent — deleting a non-existent config returns false 
but no error.
+func (n *nacosMetadataReport) UnPublishAppMetadata(application, revision 
string) error {
+       // Delete primary config (compatible with java impl)
+       _, err := n.client.Client().DeleteConfig(vo.ConfigParam{
+               DataId: application,
+               Group:  revision,
+       })
+       if err != nil {
+               return perrors.WithMessage(err, "Could not delete the metadata")
+       }
+       // Delete legacy config (compatible with dubbo-go 3.1.x).
+       if _, err = n.client.Client().DeleteConfig(vo.ConfigParam{
+               DataId: application + constant.KeySeparator + revision,
+               Group:  n.group,
+       }); err != nil {
+               logger.Warnf("[Metadata][Nacos] could not delete legacy 
metadata for app=%s rev=%s: %v",
+                       application, revision, err)
+       }
+       return nil
+}
+
+// ListAppRevisions lists all stored revisions for an application from nacos.
+func (n *nacosMetadataReport) ListAppRevisions(application string) 
([]report.AppRevision, error) {
+       pageNo, pageSize := 1, 500
+       configs, err := n.client.Client().SearchConfig(vo.SearchConfigParam{
+               Search:   "accurate",
+               DataId:   application,
+               Group:    "",
+               PageNo:   pageNo,
+               PageSize: pageSize,
+       })
+       if err != nil {
+               return nil, perrors.WithMessage(err, "Could not search configs 
for ListAppRevisions")
+       }
+       if configs == nil || len(configs.PageItems) == 0 {
+               return nil, nil
+       }
+       if int(configs.TotalCount) > len(configs.PageItems) {
+               logger.Warnf("ListAppRevisions for app=%s: total configs (%d) 
exceeds page size (%d), "+

Review Comment:
   copilot要求for循环分页查询,所以该日志已经删除了



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to