MCPcopy Create free account
hub / github.com/apache/fory / ReadNamedTypeInfo

Method ReadNamedTypeInfo

csharp/src/Fory/TypeResolver.cs:810–873  ·  view source on GitHub ↗
(
        TypeInfo typeInfo,
        TypeId wireTypeId,
        UserTypeKind declaredKind,
        bool registerByName,
        bool compatible,
        ReadContext context)

Source from the content-addressed store, hash-verified

808 }
809
810 private void ReadNamedTypeInfo(
811 TypeInfo typeInfo,
812 TypeId wireTypeId,
813 UserTypeKind declaredKind,
814 bool registerByName,
815 bool compatible,
816 ReadContext context)
817 {
818 if (compatible)
819 {
820 if (context.TryReadTypeMetaRef(out int index, out TypeMeta remoteTypeMeta))
821 {
822 if (!HasValidatedTypeMeta(typeInfo, remoteTypeMeta))
823 {
824 ValidateRemoteTypeMeta(remoteTypeMeta, typeInfo, wireTypeId, assignFieldIds: false, context);
825 }
826 }
827 else
828 {
829 ulong header = context.Reader.ReadUInt64();
830 if (context.TryGetTypeMetaByHeader(header, out remoteTypeMeta))
831 {
832 TypeMeta.SkipBody(context.Reader, header);
833 context.StoreTypeMetaRef(remoteTypeMeta, index);
834 if (!HasValidatedTypeMeta(typeInfo, remoteTypeMeta))
835 {
836 ValidateRemoteTypeMeta(remoteTypeMeta, typeInfo, wireTypeId, assignFieldIds: false, context);
837 }
838 }
839 else
840 {
841 _ = ReadRemoteTypeMeta(
842 typeInfo,
843 wireTypeId,
844 assignFieldIds: false,
845 context,
846 index,
847 header);
848 }
849 }
850
851 return;
852 }
853
854 MetaString namespaceName = ReadMetaString(
855 context,
856 MetaStringDecoder.Namespace,
857 TypeMetaEncodings.NamespaceMetaStringEncodings);
858 MetaString typeName = ReadMetaString(
859 context,
860 MetaStringDecoder.TypeName,
861 TypeMetaEncodings.TypeNameMetaStringEncodings);
862 if (!typeInfo.RegisterByName || !typeInfo.NamespaceName.HasValue || !typeInfo.TypeName.HasValue)
863 {
864 throw new InvalidDataException("received name-registered type info for id-registered local type");
865 }
866
867 if (namespaceName.Value != typeInfo.NamespaceName.Value.Value ||

Callers

nothing calls this directly

Calls 5

TryReadTypeMetaRefMethod · 0.80
ReadUInt64Method · 0.80
SkipBodyMethod · 0.80
StoreTypeMetaRefMethod · 0.80

Tested by

no test coverage detected