Skip to content

Commit b6404fa

Browse files
EasterTheBunnyconnorwstein
authored andcommitted
add field to capability response metadata to convey the total number … (#1574)
* add field to capability response metadata to convey the total number of don participants * update property for better clarity and add to helpers
1 parent 7d07720 commit b6404fa

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

pkg/capabilities/capabilities.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type CapabilityResponse struct {
7474

7575
type ResponseMetadata struct {
7676
Metering []MeteringNodeDetail
77+
CapDON_N uint32
7778
}
7879

7980
type MeteringNodeDetail struct {

pkg/capabilities/pb/capabilities.pb.go

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/capabilities/pb/capabilities.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ message ResponseMetadata {
127127
// If you are working with this in a capability, you should not emit
128128
// more than one metering report per node.
129129
repeated metering.MeteringReportNodeDetail metering = 1;
130+
// capdon_n represents the total number of nodes in a capability don.
131+
uint32 capdon_n = 2;
130132
}
131133

132134
message RegistrationMetadata {

pkg/capabilities/pb/capabilities_helpers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ func CapabilityResponseToProto(resp capabilities.CapabilityResponse) *Capability
9090
Value: values.ProtoMap(resp.Value),
9191
Metadata: &ResponseMetadata{
9292
Metering: metering,
93+
CapdonN: resp.Metadata.CapDON_N,
9394
},
9495
Payload: resp.Payload,
9596
}
@@ -166,6 +167,7 @@ func CapabilityResponseFromProto(pr *CapabilityResponse) (capabilities.Capabilit
166167
Value: val,
167168
Metadata: capabilities.ResponseMetadata{
168169
Metering: metering,
170+
CapDON_N: pr.Metadata.GetCapdonN(),
169171
},
170172
Payload: pr.Payload,
171173
}

0 commit comments

Comments
 (0)