diff --git a/pkg/cache/types/types.go b/pkg/cache/types/types.go index 72de474503..4059c315d0 100644 --- a/pkg/cache/types/types.go +++ b/pkg/cache/types/types.go @@ -9,9 +9,6 @@ import ( // Resource is the base interface for the xDS payload. type Resource interface { proto.Message -} - -type VtResource interface { MarshalVTStrict() ([]byte, error) } diff --git a/pkg/cache/v3/resource.go b/pkg/cache/v3/resource.go index 68ae28e966..460b22dc96 100644 --- a/pkg/cache/v3/resource.go +++ b/pkg/cache/v3/resource.go @@ -25,7 +25,6 @@ import ( runtime "github.com/envoyproxy/go-control-plane/envoy/service/runtime/v3" "github.com/envoyproxy/go-control-plane/pkg/cache/types" "github.com/envoyproxy/go-control-plane/pkg/resource/v3" - "google.golang.org/protobuf/proto" ) // GetResponseType returns the enumeration for a valid xDS type URL. @@ -124,14 +123,7 @@ func GetResourceWithTTLNames(resources []types.ResourceWithTTL) []string { // MarshalResource converts the Resource to MarshaledResource. func MarshalResource(resource types.Resource) (types.MarshaledResource, error) { - switch v := resource.(type) { - case types.VtResource: - return v.MarshalVTStrict() - case types.Resource: - return proto.MarshalOptions{Deterministic: true}.Marshal(v) - default: - return nil, fmt.Errorf("failed to marshal, message is %T, must satisfy the vtprotoMessage interface or want proto.Message", v) - } + return resource.MarshalVTStrict() } // GetResourceReferences returns a map of dependent resources keyed by resource type, given a map of resources.