From 1aaf2e08040947bcd2c94e9e637c925712504af0 Mon Sep 17 00:00:00 2001 From: Awbrey Hughlett Date: Wed, 1 Oct 2025 10:41:03 -0500 Subject: [PATCH 1/2] add field to capability response metadata to convey the total number of don participants --- pkg/capabilities/capabilities.go | 1 + pkg/capabilities/pb/capabilities.pb.go | 16 +++++++++++++--- pkg/capabilities/pb/capabilities.proto | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pkg/capabilities/capabilities.go b/pkg/capabilities/capabilities.go index 86565d599..66b16e02e 100644 --- a/pkg/capabilities/capabilities.go +++ b/pkg/capabilities/capabilities.go @@ -74,6 +74,7 @@ type CapabilityResponse struct { type ResponseMetadata struct { Metering []MeteringNodeDetail + N uint32 } type MeteringNodeDetail struct { diff --git a/pkg/capabilities/pb/capabilities.pb.go b/pkg/capabilities/pb/capabilities.pb.go index d82ad26e7..853c21a38 100644 --- a/pkg/capabilities/pb/capabilities.pb.go +++ b/pkg/capabilities/pb/capabilities.pb.go @@ -796,7 +796,9 @@ type ResponseMetadata struct { // // If you are working with this in a capability, you should not emit // more than one metering report per node. - Metering []*pb1.MeteringReportNodeDetail `protobuf:"bytes,1,rep,name=metering,proto3" json:"metering,omitempty"` + Metering []*pb1.MeteringReportNodeDetail `protobuf:"bytes,1,rep,name=metering,proto3" json:"metering,omitempty"` + // n represents the total number of nodes in a capability don. + N uint32 `protobuf:"varint,2,opt,name=n,proto3" json:"n,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -838,6 +840,13 @@ func (x *ResponseMetadata) GetMetering() []*pb1.MeteringReportNodeDetail { return nil } +func (x *ResponseMetadata) GetN() uint32 { + if x != nil { + return x.N + } + return 0 +} + type RegistrationMetadata struct { state protoimpl.MessageState `protogen:"open.v1"` WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` @@ -1223,9 +1232,10 @@ const file_capabilities_proto_rawDesc = "" + "\x05value\x18\x01 \x01(\v2\x0e.values.v1.MapR\x05value\x12\x14\n" + "\x05error\x18\x02 \x01(\tR\x05error\x12:\n" + "\bmetadata\x18\x03 \x01(\v2\x1e.capabilities.ResponseMetadataR\bmetadata\x12.\n" + - "\apayload\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\apayload\"R\n" + + "\apayload\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\apayload\"`\n" + "\x10ResponseMetadata\x12>\n" + - "\bmetering\x18\x01 \x03(\v2\".metering.MeteringReportNodeDetailR\bmetering\"\x81\x01\n" + + "\bmetering\x18\x01 \x03(\v2\".metering.MeteringReportNodeDetailR\bmetering\x12\f\n" + + "\x01n\x18\x02 \x01(\rR\x01n\"\x81\x01\n" + "\x14RegistrationMetadata\x12\x1f\n" + "\vworkflow_id\x18\x01 \x01(\tR\n" + "workflowId\x12!\n" + diff --git a/pkg/capabilities/pb/capabilities.proto b/pkg/capabilities/pb/capabilities.proto index b18ca5e5a..80826ad09 100644 --- a/pkg/capabilities/pb/capabilities.proto +++ b/pkg/capabilities/pb/capabilities.proto @@ -127,6 +127,8 @@ message ResponseMetadata { // If you are working with this in a capability, you should not emit // more than one metering report per node. repeated metering.MeteringReportNodeDetail metering = 1; + // n represents the total number of nodes in a capability don. + uint32 n = 2; } message RegistrationMetadata { From 867bd8e873f5ec6ec6225d3b9fabcdebe405f274 Mon Sep 17 00:00:00 2001 From: Awbrey Hughlett Date: Mon, 6 Oct 2025 10:20:44 -0500 Subject: [PATCH 2/2] update property for better clarity and add to helpers --- pkg/capabilities/capabilities.go | 2 +- pkg/capabilities/pb/capabilities.pb.go | 14 +++++++------- pkg/capabilities/pb/capabilities.proto | 4 ++-- pkg/capabilities/pb/capabilities_helpers.go | 2 ++ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkg/capabilities/capabilities.go b/pkg/capabilities/capabilities.go index 66b16e02e..a06cf8fce 100644 --- a/pkg/capabilities/capabilities.go +++ b/pkg/capabilities/capabilities.go @@ -74,7 +74,7 @@ type CapabilityResponse struct { type ResponseMetadata struct { Metering []MeteringNodeDetail - N uint32 + CapDON_N uint32 } type MeteringNodeDetail struct { diff --git a/pkg/capabilities/pb/capabilities.pb.go b/pkg/capabilities/pb/capabilities.pb.go index 853c21a38..f53a95ecb 100644 --- a/pkg/capabilities/pb/capabilities.pb.go +++ b/pkg/capabilities/pb/capabilities.pb.go @@ -797,8 +797,8 @@ type ResponseMetadata struct { // If you are working with this in a capability, you should not emit // more than one metering report per node. Metering []*pb1.MeteringReportNodeDetail `protobuf:"bytes,1,rep,name=metering,proto3" json:"metering,omitempty"` - // n represents the total number of nodes in a capability don. - N uint32 `protobuf:"varint,2,opt,name=n,proto3" json:"n,omitempty"` + // capdon_n represents the total number of nodes in a capability don. + CapdonN uint32 `protobuf:"varint,2,opt,name=capdon_n,json=capdonN,proto3" json:"capdon_n,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -840,9 +840,9 @@ func (x *ResponseMetadata) GetMetering() []*pb1.MeteringReportNodeDetail { return nil } -func (x *ResponseMetadata) GetN() uint32 { +func (x *ResponseMetadata) GetCapdonN() uint32 { if x != nil { - return x.N + return x.CapdonN } return 0 } @@ -1232,10 +1232,10 @@ const file_capabilities_proto_rawDesc = "" + "\x05value\x18\x01 \x01(\v2\x0e.values.v1.MapR\x05value\x12\x14\n" + "\x05error\x18\x02 \x01(\tR\x05error\x12:\n" + "\bmetadata\x18\x03 \x01(\v2\x1e.capabilities.ResponseMetadataR\bmetadata\x12.\n" + - "\apayload\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\apayload\"`\n" + + "\apayload\x18\x04 \x01(\v2\x14.google.protobuf.AnyR\apayload\"m\n" + "\x10ResponseMetadata\x12>\n" + - "\bmetering\x18\x01 \x03(\v2\".metering.MeteringReportNodeDetailR\bmetering\x12\f\n" + - "\x01n\x18\x02 \x01(\rR\x01n\"\x81\x01\n" + + "\bmetering\x18\x01 \x03(\v2\".metering.MeteringReportNodeDetailR\bmetering\x12\x19\n" + + "\bcapdon_n\x18\x02 \x01(\rR\acapdonN\"\x81\x01\n" + "\x14RegistrationMetadata\x12\x1f\n" + "\vworkflow_id\x18\x01 \x01(\tR\n" + "workflowId\x12!\n" + diff --git a/pkg/capabilities/pb/capabilities.proto b/pkg/capabilities/pb/capabilities.proto index 80826ad09..bb491b372 100644 --- a/pkg/capabilities/pb/capabilities.proto +++ b/pkg/capabilities/pb/capabilities.proto @@ -127,8 +127,8 @@ message ResponseMetadata { // If you are working with this in a capability, you should not emit // more than one metering report per node. repeated metering.MeteringReportNodeDetail metering = 1; - // n represents the total number of nodes in a capability don. - uint32 n = 2; + // capdon_n represents the total number of nodes in a capability don. + uint32 capdon_n = 2; } message RegistrationMetadata { diff --git a/pkg/capabilities/pb/capabilities_helpers.go b/pkg/capabilities/pb/capabilities_helpers.go index 4bf2e8583..8c03be56d 100644 --- a/pkg/capabilities/pb/capabilities_helpers.go +++ b/pkg/capabilities/pb/capabilities_helpers.go @@ -90,6 +90,7 @@ func CapabilityResponseToProto(resp capabilities.CapabilityResponse) *Capability Value: values.ProtoMap(resp.Value), Metadata: &ResponseMetadata{ Metering: metering, + CapdonN: resp.Metadata.CapDON_N, }, Payload: resp.Payload, } @@ -166,6 +167,7 @@ func CapabilityResponseFromProto(pr *CapabilityResponse) (capabilities.Capabilit Value: val, Metadata: capabilities.ResponseMetadata{ Metering: metering, + CapDON_N: pr.Metadata.GetCapdonN(), }, Payload: pr.Payload, }