@@ -1369,6 +1369,46 @@ public async override Task ShutdownSidecarAsync(CancellationToken cancellationTo
13691369 await client . ShutdownAsync ( new Empty ( ) , CreateCallOptions ( null , cancellationToken ) ) ;
13701370 }
13711371
1372+ /// <inheritdoc/>
1373+ public override async Task < DaprMetadata > GetMetadataAsync ( CancellationToken cancellationToken = default )
1374+ {
1375+ var options = CreateCallOptions ( headers : null , cancellationToken ) ;
1376+ try
1377+ {
1378+ var response = await client . GetMetadataAsync ( new Empty ( ) , options ) ;
1379+ return new DaprMetadata ( response . Id ,
1380+ response . ActiveActorsCount . Select ( c => new DaprActorMetadata ( c . Type , c . Count ) ) . ToList ( ) ,
1381+ response . ExtendedMetadata . ToDictionary ( c => c . Key , c => c . Value ) ,
1382+ response . RegisteredComponents . Select ( c => new DaprComponentsMetadata ( c . Name , c . Type , c . Version , c . Capabilities . ToArray ( ) ) ) . ToList ( ) ) ;
1383+ }
1384+ catch ( RpcException ex )
1385+ {
1386+ throw new DaprException ( "Get metadata operation failed: the Dapr endpoint indicated a failure. See InnerException for details." , ex ) ;
1387+ }
1388+ }
1389+
1390+ /// <inheritdoc/>
1391+ public override async Task SetMetadataAsync ( string attributeName , string attributeValue , CancellationToken cancellationToken = default )
1392+ {
1393+ ArgumentVerifier . ThrowIfNullOrEmpty ( attributeName , nameof ( attributeName ) ) ;
1394+
1395+ var envelope = new Autogenerated . SetMetadataRequest ( )
1396+ {
1397+ Key = attributeName ,
1398+ Value = attributeValue
1399+ } ;
1400+
1401+ var options = CreateCallOptions ( headers : null , cancellationToken ) ;
1402+
1403+ try
1404+ {
1405+ _ = await this . Client . SetMetadataAsync ( envelope , options ) ;
1406+ }
1407+ catch ( RpcException ex )
1408+ {
1409+ throw new DaprException ( "Set metadata operation failed: the Dapr endpoint indicated a failure. See InnerException for details." , ex ) ;
1410+ }
1411+ }
13721412 #endregion
13731413
13741414 protected override void Dispose ( bool disposing )
0 commit comments