MCPcopy Create free account
hub / github.com/compozy/agh / ValidateNetworkChannelFanoutConfiguration

Function ValidateNetworkChannelFanoutConfiguration

internal/store/types.go:878–894  ·  view source on GitHub ↗

ValidateNetworkChannelFanoutConfiguration checks policy and coordinator coupling for channel metadata.

(policy string, coordinatorPeerID string)

Source from the content-addressed store, hash-verified

876// ValidateNetworkChannelFanoutConfiguration checks policy and coordinator
877// coupling for channel metadata.
878func ValidateNetworkChannelFanoutConfiguration(policy string, coordinatorPeerID string) error {
879 normalized := NormalizeNetworkFanoutPolicy(policy)
880 if err := ValidateNetworkFanoutPolicy(normalized); err != nil {
881 return err
882 }
883 coordinator := strings.TrimSpace(coordinatorPeerID)
884 if normalized == NetworkFanoutPolicyCoordinator {
885 if coordinator == "" {
886 return errors.New("store: network channel coordinator_peer_id is required for coordinator fanout policy")
887 }
888 return nil
889 }
890 if coordinator != "" {
891 return errors.New("store: network channel coordinator_peer_id requires coordinator fanout policy")
892 }
893 return nil
894}
895
896// NormalizeNetworkFanoutPolicy applies the default channel activation policy.
897func NormalizeNetworkFanoutPolicy(policy string) string {

Callers 3

networkChannelCreateMethod · 0.92
ValidateMethod · 0.85

Calls 2

Tested by

no test coverage detected