From bfb2697f25abbb2a2a900ab258900117f01035b8 Mon Sep 17 00:00:00 2001 From: tan Date: Sat, 17 Oct 2020 21:43:32 +0530 Subject: [PATCH] make protobuf metadata access thread safe Most of the book-keeping data for a protobuf struct is kept inside the struct instance. So that does not hinder thread safe usage. However struct instances themselves need to be locked if they are being read and written to from different threads, as is expected of any regular Julia struct. Protobuf metadata for a struct (the information about fields and their properties as mentioned in the protobuf IDL definition) however is best initialized once and reused. It was not possible to generate code in such a way that it could be initialized when code is loaded and pre-compiled. This was because of the need to support nested and recursive struct references that protobuf allows - metadata for a struct could be defined only after the struct and all of its dependencies were defined. Metadata initialization had to be deferred to the first constructor call. But in order to reuse the metadata definition, it gets stored into a `Ref` that is set once. A process wide lock is used to make access to it thread safe. There is a small cost to be borne for that, and it should be negligible for most usages. If an application wishes to eliminate that cost entirely, then the way to do it would be to call the constructors of all protobuf structs it wishes to use first and then switch the lock off by calling `ProtoBuf.enable_async_safety(false)`. Once all metadata definitiions have been initialized, this would allow them to be used without any further locking overhead. This can also be set to `false` for a single threaded synchronous applicaation where it is known that no parallelism is possible. --- USAGE.md | 10 + src/codec.jl | 28 +++ src/gen.jl | 64 +++--- src/google/any_pb.jl | 12 +- src/google/api_pb.jl | 36 +-- src/google/descriptor_pb.jl | 390 ++++++++++++++++++-------------- src/google/duration_pb.jl | 12 +- src/google/empty_pb.jl | 12 +- src/google/field_mask_pb.jl | 12 +- src/google/plugin_pb.jl | 54 +++-- src/google/source_context_pb.jl | 12 +- src/google/struct_pb.jl | 52 +++-- src/google/timestamp_pb.jl | 12 +- src/google/type_pb.jl | 62 ++--- src/google/wrappers_pb.jl | 108 +++++---- test/runtests.jl | 1 + test/testmetalock.jl | 15 ++ 17 files changed, 532 insertions(+), 360 deletions(-) create mode 100644 test/testmetalock.jl diff --git a/USAGE.md b/USAGE.md index ec1d503..d644de5 100644 --- a/USAGE.md +++ b/USAGE.md @@ -119,12 +119,22 @@ true ```` ## Equality & Hash Value + It is possible for fields marked as optional to be in an "unset" state. Even bits type fields (`isbitstype(T) == true`) can be in this state though they may have valid contents. Such fields should then not be compared for equality or used for computing hash values. All ProtoBuf compatible types, by virtue of extending abstract `ProtoType` type, override `hash`, `isequal` and `==` methods to handle this. ## Other Methods + - `copy!{T}(to::T, from::T)` : shallow copy of objects - `isfilled(obj)` : same as `isinitialized` - `lookup(en, val::Integer)` : lookup the name (symbol) corresponding to an enum value - `enumstr(enumname, enumvalue::Int32)`: returns a string with the enum field name matching the value - `which_oneof(obj, oneof::Symbol)`: returns a symbol indicating the name of the field in the `oneof` group that is filled +## Thread safety + +Most of the book-keeping data for a protobuf struct is kept inside the struct instance. So that does not hinder thread safe usage. However struct instances themselves need to be locked if they are being read and written to from different threads, as is expected of any regular Julia struct. + +Protobuf metadata for a struct (the information about fields and their properties as mentioned in the protobuf IDL definition) however is best initialized once and reused. It was not possible to generate code in such a way that it could be initialized when code is loaded and pre-compiled. This was because of the need to support nested and recursive struct references that protobuf allows - metadata for a struct could be defined only after the struct and all of its dependencies were defined. Metadata initialization had to be deferred to the first constructor call. But in order to reuse the metadata definition, it gets stored into a `Ref` that is set once. A process wide lock is used to make access to it thread safe. There is a small cost to be borne for that, and it should be negligible for most usages. + +If an application wishes to eliminate that cost entirely, then the way to do it would be to call the constructors of all protobuf structs it wishes to use first and then switch the lock off by calling `ProtoBuf.enable_async_safety(false)`. Once all metadata definitiions have been initialized, this would allow them to be used without any further locking overhead. This can also be set to `false` for a single threaded synchronous application where it is known that no parallelism is possible. + diff --git a/src/codec.jl b/src/codec.jl index cd7df99..b15db33 100644 --- a/src/codec.jl +++ b/src/codec.jl @@ -1,3 +1,25 @@ +mutable struct ProtoMetaLock + lck::Union{Nothing,ReentrantLock} +end + +function Base.lock(f, l::ProtoMetaLock) + (l.lck === nothing) && (return f()) + lock(l.lck) do + f() + end +end + +const MetaLock = ProtoMetaLock(ReentrantLock()) + +function enable_async_safety(dolock::Bool) + if dolock + (MetaLock.lck === nothing) && (MetaLock.lck = ReentrantLock()) + else + (MetaLock.lck !== nothing) && (MetaLock.lck = nothing) + end + MetaLock.lck +end + const MSB = 0x80 const MASK7 = 0x7f const MASK8 = 0xff @@ -541,6 +563,12 @@ const DEF_ONEOFS = Int[] const DEF_ONEOF_NAMES = Symbol[] const DEF_FIELD_TYPES = Dict{Symbol,String}() +function metalock(f) + lock(MetaLock) do + f() + end +end + _resolve_type(relativeto::Type, typ::Type) = typ _resolve_type(relativeto::Type, typ::String) = Core.eval(relativeto.name.module, Meta.parse(typ)) diff --git a/src/gen.jl b/src/gen.jl index 1fc9ad2..9d133c1 100644 --- a/src/gen.jl +++ b/src/gen.jl @@ -464,43 +464,44 @@ function generate_msgtype(outio::IO, errio::IO, dtype::DescriptorProto, scope::S end # generate struct body - println(io, """mutable struct $(dtypename) <: ProtoType - __protobuf_jl_internal_meta::ProtoMeta - __protobuf_jl_internal_values::Dict{Symbol,Any} - - function $(dtypename)(; kwargs...) - obj = new(meta($(dtypename)), Dict{Symbol,Any}()) - values = obj.__protobuf_jl_internal_values - symdict = obj.__protobuf_jl_internal_meta.symdict - for nv in kwargs - fldname, fldval = nv - fldtype = symdict[fldname].jtyp - (fldname in keys(symdict)) || error(string(typeof(obj), " has no field with name ", fldname)) - values[fldname] = isa(fldval, fldtype) ? fldval : convert(fldtype, fldval) - end - obj - end""") + println(io, """ + mutable struct $(dtypename) <: ProtoType + __protobuf_jl_internal_meta::ProtoMeta + __protobuf_jl_internal_values::Dict{Symbol,Any} + + function $(dtypename)(; kwargs...) + obj = new(meta($(dtypename)), Dict{Symbol,Any}()) + values = obj.__protobuf_jl_internal_values + symdict = obj.__protobuf_jl_internal_meta.symdict + for nv in kwargs + fldname, fldval = nv + fldtype = symdict[fldname].jtyp + (fldname in keys(symdict)) || error(string(typeof(obj), " has no field with name ", fldname)) + values[fldname] = isa(fldval, fldtype) ? fldval : convert(fldtype, fldval) + end + obj + end""") println(io, "end # mutable struct $(dtypename)", ismapentry ? " (mapentry)" : "", deferedmode ? " (has cyclic type dependency)" : "") # generate the meta for this type @debug("generating meta", dtypename) _d_fldnums = [1:length(fldnums);] - println(io, "const __meta_$(dtypename) = Ref{ProtoMeta}()") - println(io, "function meta(::Type{$dtypename})") - println(io, " if !isassigned(__meta_$dtypename)") - println(io, " __meta_$(dtypename)[] = target = ProtoMeta($dtypename)") - !isempty(reqflds) && println(io, " req = Symbol[$(join(reqflds, ','))]") - !isempty(defvals) && println(io, " val = Dict{Symbol,Any}($(join(defvals, ", ")))") - (fldnums != _d_fldnums) && println(io, " fnum = Int[$(join(fldnums, ','))]") - !isempty(packedflds) && println(io, " pack = Symbol[$(join(packedflds, ','))]") - !isempty(wtypes) && println(io, " wtype = Dict($(join(wtypes, ", ")))") - println(io, " allflds = Pair{Symbol,Union{Type,String}}[$(join(allflds, ", "))]") + println(io, """const __meta_$(dtypename) = Ref{ProtoMeta}() + function meta(::Type{$dtypename}) + ProtoBuf.metalock() do + if !isassigned(__meta_$dtypename) + __meta_$(dtypename)[] = target = ProtoMeta($dtypename)""") + !isempty(reqflds) && println(io, " req = Symbol[$(join(reqflds, ','))]") + !isempty(defvals) && println(io, " val = Dict{Symbol,Any}($(join(defvals, ", ")))") + (fldnums != _d_fldnums) && println(io, " fnum = Int[$(join(fldnums, ','))]") + !isempty(packedflds) && println(io, " pack = Symbol[$(join(packedflds, ','))]") + !isempty(wtypes) && println(io, " wtype = Dict($(join(wtypes, ", ")))") + println(io, " allflds = Pair{Symbol,Union{Type,String}}[$(join(allflds, ", "))]") if !isempty(oneofs) - println(io, " oneofs = Int[$(join(oneofs, ','))]") - println(io, " oneof_names = Symbol[$(join(oneof_names, ','))]") + println(io, " oneofs = Int[$(join(oneofs, ','))]") + println(io, " oneof_names = Symbol[$(join(oneof_names, ','))]") end - - print(io, " meta(target, $(dtypename), allflds, ") + print(io, " meta(target, $(dtypename), allflds, ") print(io, isempty(reqflds) ? "ProtoBuf.DEF_REQ, " : "req, ") print(io, (fldnums == _d_fldnums) ? "ProtoBuf.DEF_FNUM, " : "fnum, ") print(io, isempty(defvals) ? "ProtoBuf.DEF_VAL, " : "val, ") @@ -509,8 +510,9 @@ function generate_msgtype(outio::IO, errio::IO, dtype::DescriptorProto, scope::S print(io, isempty(oneofs) ? "ProtoBuf.DEF_ONEOFS, " : "oneofs, ") print(io, isempty(oneofs) ? "ProtoBuf.DEF_ONEOF_NAMES" : "oneof_names") println(io, ")") + println(io, " end") + println(io, " __meta_$(dtypename)[]") println(io, " end") - println(io, " __meta_$(dtypename)[]") println(io, "end") # generate new getproperty method diff --git a/src/google/any_pb.jl b/src/google/any_pb.jl index d21b845..c92aa92 100644 --- a/src/google/any_pb.jl +++ b/src/google/any_pb.jl @@ -18,12 +18,14 @@ mutable struct _Any <: ProtoType end # mutable struct _Any const __meta__Any = Ref{ProtoMeta}() function meta(::Type{_Any}) - if !isassigned(__meta__Any) - __meta__Any[] = target = ProtoMeta(_Any) - allflds = Pair{Symbol,Union{Type,String}}[:type_url => AbstractString, :value => Array{UInt8,1}] - meta(target, _Any, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta__Any) + __meta__Any[] = target = ProtoMeta(_Any) + allflds = Pair{Symbol,Union{Type,String}}[:type_url => AbstractString, :value => Array{UInt8,1}] + meta(target, _Any, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta__Any[] end - __meta__Any[] end function Base.getproperty(obj::_Any, name::Symbol) if name === :type_url diff --git a/src/google/api_pb.jl b/src/google/api_pb.jl index 15dfad3..c59fb9e 100644 --- a/src/google/api_pb.jl +++ b/src/google/api_pb.jl @@ -18,12 +18,14 @@ mutable struct Method <: ProtoType end # mutable struct Method const __meta_Method = Ref{ProtoMeta}() function meta(::Type{Method}) - if !isassigned(__meta_Method) - __meta_Method[] = target = ProtoMeta(Method) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :request_type_url => AbstractString, :request_streaming => Bool, :response_type_url => AbstractString, :response_streaming => Bool, :options => Base.Vector{Option}, :syntax => Int32] - meta(target, Method, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Method) + __meta_Method[] = target = ProtoMeta(Method) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :request_type_url => AbstractString, :request_streaming => Bool, :response_type_url => AbstractString, :response_streaming => Bool, :options => Base.Vector{Option}, :syntax => Int32] + meta(target, Method, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Method[] end - __meta_Method[] end function Base.getproperty(obj::Method, name::Symbol) if name === :name @@ -64,12 +66,14 @@ mutable struct Mixin <: ProtoType end # mutable struct Mixin const __meta_Mixin = Ref{ProtoMeta}() function meta(::Type{Mixin}) - if !isassigned(__meta_Mixin) - __meta_Mixin[] = target = ProtoMeta(Mixin) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :root => AbstractString] - meta(target, Mixin, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Mixin) + __meta_Mixin[] = target = ProtoMeta(Mixin) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :root => AbstractString] + meta(target, Mixin, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Mixin[] end - __meta_Mixin[] end function Base.getproperty(obj::Mixin, name::Symbol) if name === :name @@ -100,12 +104,14 @@ mutable struct Api <: ProtoType end # mutable struct Api const __meta_Api = Ref{ProtoMeta}() function meta(::Type{Api}) - if !isassigned(__meta_Api) - __meta_Api[] = target = ProtoMeta(Api) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :methods => Base.Vector{Method}, :options => Base.Vector{Option}, :version => AbstractString, :source_context => SourceContext, :mixins => Base.Vector{Mixin}, :syntax => Int32] - meta(target, Api, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Api) + __meta_Api[] = target = ProtoMeta(Api) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :methods => Base.Vector{Method}, :options => Base.Vector{Option}, :version => AbstractString, :source_context => SourceContext, :mixins => Base.Vector{Mixin}, :syntax => Int32] + meta(target, Api, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Api[] end - __meta_Api[] end function Base.getproperty(obj::Api, name::Symbol) if name === :name diff --git a/src/google/descriptor_pb.jl b/src/google/descriptor_pb.jl index f9b9ab4..88dac20 100644 --- a/src/google/descriptor_pb.jl +++ b/src/google/descriptor_pb.jl @@ -18,13 +18,15 @@ mutable struct UninterpretedOption_NamePart <: ProtoType end # mutable struct UninterpretedOption_NamePart const __meta_UninterpretedOption_NamePart = Ref{ProtoMeta}() function meta(::Type{UninterpretedOption_NamePart}) - if !isassigned(__meta_UninterpretedOption_NamePart) - __meta_UninterpretedOption_NamePart[] = target = ProtoMeta(UninterpretedOption_NamePart) - req = Symbol[:name_part,:is_extension] - allflds = Pair{Symbol,Union{Type,String}}[:name_part => AbstractString, :is_extension => Bool] - meta(target, UninterpretedOption_NamePart, allflds, req, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_UninterpretedOption_NamePart) + __meta_UninterpretedOption_NamePart[] = target = ProtoMeta(UninterpretedOption_NamePart) + req = Symbol[:name_part,:is_extension] + allflds = Pair{Symbol,Union{Type,String}}[:name_part => AbstractString, :is_extension => Bool] + meta(target, UninterpretedOption_NamePart, allflds, req, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_UninterpretedOption_NamePart[] end - __meta_UninterpretedOption_NamePart[] end function Base.getproperty(obj::UninterpretedOption_NamePart, name::Symbol) if name === :name_part @@ -55,13 +57,15 @@ mutable struct UninterpretedOption <: ProtoType end # mutable struct UninterpretedOption const __meta_UninterpretedOption = Ref{ProtoMeta}() function meta(::Type{UninterpretedOption}) - if !isassigned(__meta_UninterpretedOption) - __meta_UninterpretedOption[] = target = ProtoMeta(UninterpretedOption) - fnum = Int[2,3,4,5,6,7,8] - allflds = Pair{Symbol,Union{Type,String}}[:name => Base.Vector{UninterpretedOption_NamePart}, :identifier_value => AbstractString, :positive_int_value => UInt64, :negative_int_value => Int64, :double_value => Float64, :string_value => Array{UInt8,1}, :aggregate_value => AbstractString] - meta(target, UninterpretedOption, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_UninterpretedOption) + __meta_UninterpretedOption[] = target = ProtoMeta(UninterpretedOption) + fnum = Int[2,3,4,5,6,7,8] + allflds = Pair{Symbol,Union{Type,String}}[:name => Base.Vector{UninterpretedOption_NamePart}, :identifier_value => AbstractString, :positive_int_value => UInt64, :negative_int_value => Int64, :double_value => Float64, :string_value => Array{UInt8,1}, :aggregate_value => AbstractString] + meta(target, UninterpretedOption, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_UninterpretedOption[] end - __meta_UninterpretedOption[] end function Base.getproperty(obj::UninterpretedOption, name::Symbol) if name === :name @@ -114,14 +118,16 @@ mutable struct FieldOptions <: ProtoType end # mutable struct FieldOptions const __meta_FieldOptions = Ref{ProtoMeta}() function meta(::Type{FieldOptions}) - if !isassigned(__meta_FieldOptions) - __meta_FieldOptions[] = target = ProtoMeta(FieldOptions) - val = Dict{Symbol,Any}(:ctype => FieldOptions_CType.STRING, :jstype => FieldOptions_JSType.JS_NORMAL, :lazy => false, :deprecated => false, :weak => false) - fnum = Int[1,2,6,5,3,10,999] - allflds = Pair{Symbol,Union{Type,String}}[:ctype => Int32, :packed => Bool, :jstype => Int32, :lazy => Bool, :deprecated => Bool, :weak => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, FieldOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_FieldOptions[] + ProtoBuf.metalock() do + if !isassigned(__meta_FieldOptions) + __meta_FieldOptions[] = target = ProtoMeta(FieldOptions) + val = Dict{Symbol,Any}(:ctype => FieldOptions_CType.STRING, :jstype => FieldOptions_JSType.JS_NORMAL, :lazy => false, :deprecated => false, :weak => false) + fnum = Int[1,2,6,5,3,10,999] + allflds = Pair{Symbol,Union{Type,String}}[:ctype => Int32, :packed => Bool, :jstype => Int32, :lazy => Bool, :deprecated => Bool, :weak => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, FieldOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_FieldOptions[] + end end function Base.getproperty(obj::FieldOptions, name::Symbol) if name === :ctype @@ -162,14 +168,16 @@ mutable struct MessageOptions <: ProtoType end # mutable struct MessageOptions const __meta_MessageOptions = Ref{ProtoMeta}() function meta(::Type{MessageOptions}) - if !isassigned(__meta_MessageOptions) - __meta_MessageOptions[] = target = ProtoMeta(MessageOptions) - val = Dict{Symbol,Any}(:message_set_wire_format => false, :no_standard_descriptor_accessor => false, :deprecated => false) - fnum = Int[1,2,3,7,999] - allflds = Pair{Symbol,Union{Type,String}}[:message_set_wire_format => Bool, :no_standard_descriptor_accessor => Bool, :deprecated => Bool, :map_entry => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, MessageOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_MessageOptions[] + ProtoBuf.metalock() do + if !isassigned(__meta_MessageOptions) + __meta_MessageOptions[] = target = ProtoMeta(MessageOptions) + val = Dict{Symbol,Any}(:message_set_wire_format => false, :no_standard_descriptor_accessor => false, :deprecated => false) + fnum = Int[1,2,3,7,999] + allflds = Pair{Symbol,Union{Type,String}}[:message_set_wire_format => Bool, :no_standard_descriptor_accessor => Bool, :deprecated => Bool, :map_entry => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, MessageOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_MessageOptions[] + end end function Base.getproperty(obj::MessageOptions, name::Symbol) if name === :message_set_wire_format @@ -206,14 +214,16 @@ mutable struct EnumOptions <: ProtoType end # mutable struct EnumOptions const __meta_EnumOptions = Ref{ProtoMeta}() function meta(::Type{EnumOptions}) - if !isassigned(__meta_EnumOptions) - __meta_EnumOptions[] = target = ProtoMeta(EnumOptions) - val = Dict{Symbol,Any}(:deprecated => false) - fnum = Int[2,3,999] - allflds = Pair{Symbol,Union{Type,String}}[:allow_alias => Bool, :deprecated => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, EnumOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_EnumOptions[] + ProtoBuf.metalock() do + if !isassigned(__meta_EnumOptions) + __meta_EnumOptions[] = target = ProtoMeta(EnumOptions) + val = Dict{Symbol,Any}(:deprecated => false) + fnum = Int[2,3,999] + allflds = Pair{Symbol,Union{Type,String}}[:allow_alias => Bool, :deprecated => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, EnumOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_EnumOptions[] + end end function Base.getproperty(obj::EnumOptions, name::Symbol) if name === :allow_alias @@ -246,13 +256,15 @@ mutable struct ExtensionRangeOptions <: ProtoType end # mutable struct ExtensionRangeOptions const __meta_ExtensionRangeOptions = Ref{ProtoMeta}() function meta(::Type{ExtensionRangeOptions}) - if !isassigned(__meta_ExtensionRangeOptions) - __meta_ExtensionRangeOptions[] = target = ProtoMeta(ExtensionRangeOptions) - fnum = Int[999] - allflds = Pair{Symbol,Union{Type,String}}[:uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, ExtensionRangeOptions, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_ExtensionRangeOptions) + __meta_ExtensionRangeOptions[] = target = ProtoMeta(ExtensionRangeOptions) + fnum = Int[999] + allflds = Pair{Symbol,Union{Type,String}}[:uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, ExtensionRangeOptions, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_ExtensionRangeOptions[] end - __meta_ExtensionRangeOptions[] end function Base.getproperty(obj::ExtensionRangeOptions, name::Symbol) if name === :uninterpreted_option @@ -287,14 +299,16 @@ mutable struct MethodOptions <: ProtoType end # mutable struct MethodOptions const __meta_MethodOptions = Ref{ProtoMeta}() function meta(::Type{MethodOptions}) - if !isassigned(__meta_MethodOptions) - __meta_MethodOptions[] = target = ProtoMeta(MethodOptions) - val = Dict{Symbol,Any}(:deprecated => false, :idempotency_level => MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN) - fnum = Int[33,34,999] - allflds = Pair{Symbol,Union{Type,String}}[:deprecated => Bool, :idempotency_level => Int32, :uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, MethodOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_MethodOptions[] + ProtoBuf.metalock() do + if !isassigned(__meta_MethodOptions) + __meta_MethodOptions[] = target = ProtoMeta(MethodOptions) + val = Dict{Symbol,Any}(:deprecated => false, :idempotency_level => MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN) + fnum = Int[33,34,999] + allflds = Pair{Symbol,Union{Type,String}}[:deprecated => Bool, :idempotency_level => Int32, :uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, MethodOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_MethodOptions[] + end end function Base.getproperty(obj::MethodOptions, name::Symbol) if name === :deprecated @@ -333,14 +347,16 @@ mutable struct FileOptions <: ProtoType end # mutable struct FileOptions const __meta_FileOptions = Ref{ProtoMeta}() function meta(::Type{FileOptions}) - if !isassigned(__meta_FileOptions) - __meta_FileOptions[] = target = ProtoMeta(FileOptions) - val = Dict{Symbol,Any}(:java_multiple_files => false, :java_string_check_utf8 => false, :optimize_for => FileOptions_OptimizeMode.SPEED, :cc_generic_services => false, :java_generic_services => false, :py_generic_services => false, :php_generic_services => false, :deprecated => false, :cc_enable_arenas => false) - fnum = Int[1,8,10,20,27,9,11,16,17,18,42,23,31,36,37,39,40,41,44,45,999] - allflds = Pair{Symbol,Union{Type,String}}[:java_package => AbstractString, :java_outer_classname => AbstractString, :java_multiple_files => Bool, :java_generate_equals_and_hash => Bool, :java_string_check_utf8 => Bool, :optimize_for => Int32, :go_package => AbstractString, :cc_generic_services => Bool, :java_generic_services => Bool, :py_generic_services => Bool, :php_generic_services => Bool, :deprecated => Bool, :cc_enable_arenas => Bool, :objc_class_prefix => AbstractString, :csharp_namespace => AbstractString, :swift_prefix => AbstractString, :php_class_prefix => AbstractString, :php_namespace => AbstractString, :php_metadata_namespace => AbstractString, :ruby_package => AbstractString, :uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, FileOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_FileOptions[] + ProtoBuf.metalock() do + if !isassigned(__meta_FileOptions) + __meta_FileOptions[] = target = ProtoMeta(FileOptions) + val = Dict{Symbol,Any}(:java_multiple_files => false, :java_string_check_utf8 => false, :optimize_for => FileOptions_OptimizeMode.SPEED, :cc_generic_services => false, :java_generic_services => false, :py_generic_services => false, :php_generic_services => false, :deprecated => false, :cc_enable_arenas => false) + fnum = Int[1,8,10,20,27,9,11,16,17,18,42,23,31,36,37,39,40,41,44,45,999] + allflds = Pair{Symbol,Union{Type,String}}[:java_package => AbstractString, :java_outer_classname => AbstractString, :java_multiple_files => Bool, :java_generate_equals_and_hash => Bool, :java_string_check_utf8 => Bool, :optimize_for => Int32, :go_package => AbstractString, :cc_generic_services => Bool, :java_generic_services => Bool, :py_generic_services => Bool, :php_generic_services => Bool, :deprecated => Bool, :cc_enable_arenas => Bool, :objc_class_prefix => AbstractString, :csharp_namespace => AbstractString, :swift_prefix => AbstractString, :php_class_prefix => AbstractString, :php_namespace => AbstractString, :php_metadata_namespace => AbstractString, :ruby_package => AbstractString, :uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, FileOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_FileOptions[] + end end function Base.getproperty(obj::FileOptions, name::Symbol) if name === :java_package @@ -409,14 +425,16 @@ mutable struct EnumValueOptions <: ProtoType end # mutable struct EnumValueOptions const __meta_EnumValueOptions = Ref{ProtoMeta}() function meta(::Type{EnumValueOptions}) - if !isassigned(__meta_EnumValueOptions) - __meta_EnumValueOptions[] = target = ProtoMeta(EnumValueOptions) - val = Dict{Symbol,Any}(:deprecated => false) - fnum = Int[1,999] - allflds = Pair{Symbol,Union{Type,String}}[:deprecated => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, EnumValueOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_EnumValueOptions[] + ProtoBuf.metalock() do + if !isassigned(__meta_EnumValueOptions) + __meta_EnumValueOptions[] = target = ProtoMeta(EnumValueOptions) + val = Dict{Symbol,Any}(:deprecated => false) + fnum = Int[1,999] + allflds = Pair{Symbol,Union{Type,String}}[:deprecated => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, EnumValueOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_EnumValueOptions[] + end end function Base.getproperty(obj::EnumValueOptions, name::Symbol) if name === :deprecated @@ -447,13 +465,15 @@ mutable struct OneofOptions <: ProtoType end # mutable struct OneofOptions const __meta_OneofOptions = Ref{ProtoMeta}() function meta(::Type{OneofOptions}) - if !isassigned(__meta_OneofOptions) - __meta_OneofOptions[] = target = ProtoMeta(OneofOptions) - fnum = Int[999] - allflds = Pair{Symbol,Union{Type,String}}[:uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, OneofOptions, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_OneofOptions) + __meta_OneofOptions[] = target = ProtoMeta(OneofOptions) + fnum = Int[999] + allflds = Pair{Symbol,Union{Type,String}}[:uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, OneofOptions, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_OneofOptions[] end - __meta_OneofOptions[] end function Base.getproperty(obj::OneofOptions, name::Symbol) if name === :uninterpreted_option @@ -482,14 +502,16 @@ mutable struct ServiceOptions <: ProtoType end # mutable struct ServiceOptions const __meta_ServiceOptions = Ref{ProtoMeta}() function meta(::Type{ServiceOptions}) - if !isassigned(__meta_ServiceOptions) - __meta_ServiceOptions[] = target = ProtoMeta(ServiceOptions) - val = Dict{Symbol,Any}(:deprecated => false) - fnum = Int[33,999] - allflds = Pair{Symbol,Union{Type,String}}[:deprecated => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] - meta(target, ServiceOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_ServiceOptions[] + ProtoBuf.metalock() do + if !isassigned(__meta_ServiceOptions) + __meta_ServiceOptions[] = target = ProtoMeta(ServiceOptions) + val = Dict{Symbol,Any}(:deprecated => false) + fnum = Int[33,999] + allflds = Pair{Symbol,Union{Type,String}}[:deprecated => Bool, :uninterpreted_option => Base.Vector{UninterpretedOption}] + meta(target, ServiceOptions, allflds, ProtoBuf.DEF_REQ, fnum, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_ServiceOptions[] + end end function Base.getproperty(obj::ServiceOptions, name::Symbol) if name === :deprecated @@ -547,13 +569,15 @@ mutable struct FieldDescriptorProto <: ProtoType end # mutable struct FieldDescriptorProto const __meta_FieldDescriptorProto = Ref{ProtoMeta}() function meta(::Type{FieldDescriptorProto}) - if !isassigned(__meta_FieldDescriptorProto) - __meta_FieldDescriptorProto[] = target = ProtoMeta(FieldDescriptorProto) - fnum = Int[1,3,4,5,6,2,7,9,10,8] - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :number => Int32, :label => Int32, :_type => Int32, :type_name => AbstractString, :extendee => AbstractString, :default_value => AbstractString, :oneof_index => Int32, :json_name => AbstractString, :options => FieldOptions] - meta(target, FieldDescriptorProto, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_FieldDescriptorProto) + __meta_FieldDescriptorProto[] = target = ProtoMeta(FieldDescriptorProto) + fnum = Int[1,3,4,5,6,2,7,9,10,8] + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :number => Int32, :label => Int32, :_type => Int32, :type_name => AbstractString, :extendee => AbstractString, :default_value => AbstractString, :oneof_index => Int32, :json_name => AbstractString, :options => FieldOptions] + meta(target, FieldDescriptorProto, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_FieldDescriptorProto[] end - __meta_FieldDescriptorProto[] end function Base.getproperty(obj::FieldDescriptorProto, name::Symbol) if name === :name @@ -600,12 +624,14 @@ mutable struct DescriptorProto_ExtensionRange <: ProtoType end # mutable struct DescriptorProto_ExtensionRange const __meta_DescriptorProto_ExtensionRange = Ref{ProtoMeta}() function meta(::Type{DescriptorProto_ExtensionRange}) - if !isassigned(__meta_DescriptorProto_ExtensionRange) - __meta_DescriptorProto_ExtensionRange[] = target = ProtoMeta(DescriptorProto_ExtensionRange) - allflds = Pair{Symbol,Union{Type,String}}[:start => Int32, :_end => Int32, :options => ExtensionRangeOptions] - meta(target, DescriptorProto_ExtensionRange, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_DescriptorProto_ExtensionRange) + __meta_DescriptorProto_ExtensionRange[] = target = ProtoMeta(DescriptorProto_ExtensionRange) + allflds = Pair{Symbol,Union{Type,String}}[:start => Int32, :_end => Int32, :options => ExtensionRangeOptions] + meta(target, DescriptorProto_ExtensionRange, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_DescriptorProto_ExtensionRange[] end - __meta_DescriptorProto_ExtensionRange[] end function Base.getproperty(obj::DescriptorProto_ExtensionRange, name::Symbol) if name === :start @@ -638,13 +664,15 @@ mutable struct MethodDescriptorProto <: ProtoType end # mutable struct MethodDescriptorProto const __meta_MethodDescriptorProto = Ref{ProtoMeta}() function meta(::Type{MethodDescriptorProto}) - if !isassigned(__meta_MethodDescriptorProto) - __meta_MethodDescriptorProto[] = target = ProtoMeta(MethodDescriptorProto) - val = Dict{Symbol,Any}(:client_streaming => false, :server_streaming => false) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :input_type => AbstractString, :output_type => AbstractString, :options => MethodOptions, :client_streaming => Bool, :server_streaming => Bool] - meta(target, MethodDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_MethodDescriptorProto) + __meta_MethodDescriptorProto[] = target = ProtoMeta(MethodDescriptorProto) + val = Dict{Symbol,Any}(:client_streaming => false, :server_streaming => false) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :input_type => AbstractString, :output_type => AbstractString, :options => MethodOptions, :client_streaming => Bool, :server_streaming => Bool] + meta(target, MethodDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, val, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_MethodDescriptorProto[] end - __meta_MethodDescriptorProto[] end function Base.getproperty(obj::MethodDescriptorProto, name::Symbol) if name === :name @@ -683,12 +711,14 @@ mutable struct EnumValueDescriptorProto <: ProtoType end # mutable struct EnumValueDescriptorProto const __meta_EnumValueDescriptorProto = Ref{ProtoMeta}() function meta(::Type{EnumValueDescriptorProto}) - if !isassigned(__meta_EnumValueDescriptorProto) - __meta_EnumValueDescriptorProto[] = target = ProtoMeta(EnumValueDescriptorProto) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :number => Int32, :options => EnumValueOptions] - meta(target, EnumValueDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_EnumValueDescriptorProto) + __meta_EnumValueDescriptorProto[] = target = ProtoMeta(EnumValueDescriptorProto) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :number => Int32, :options => EnumValueOptions] + meta(target, EnumValueDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_EnumValueDescriptorProto[] end - __meta_EnumValueDescriptorProto[] end function Base.getproperty(obj::EnumValueDescriptorProto, name::Symbol) if name === :name @@ -721,12 +751,14 @@ mutable struct EnumDescriptorProto_EnumReservedRange <: ProtoType end # mutable struct EnumDescriptorProto_EnumReservedRange const __meta_EnumDescriptorProto_EnumReservedRange = Ref{ProtoMeta}() function meta(::Type{EnumDescriptorProto_EnumReservedRange}) - if !isassigned(__meta_EnumDescriptorProto_EnumReservedRange) - __meta_EnumDescriptorProto_EnumReservedRange[] = target = ProtoMeta(EnumDescriptorProto_EnumReservedRange) - allflds = Pair{Symbol,Union{Type,String}}[:start => Int32, :_end => Int32] - meta(target, EnumDescriptorProto_EnumReservedRange, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_EnumDescriptorProto_EnumReservedRange) + __meta_EnumDescriptorProto_EnumReservedRange[] = target = ProtoMeta(EnumDescriptorProto_EnumReservedRange) + allflds = Pair{Symbol,Union{Type,String}}[:start => Int32, :_end => Int32] + meta(target, EnumDescriptorProto_EnumReservedRange, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_EnumDescriptorProto_EnumReservedRange[] end - __meta_EnumDescriptorProto_EnumReservedRange[] end function Base.getproperty(obj::EnumDescriptorProto_EnumReservedRange, name::Symbol) if name === :start @@ -757,12 +789,14 @@ mutable struct EnumDescriptorProto <: ProtoType end # mutable struct EnumDescriptorProto const __meta_EnumDescriptorProto = Ref{ProtoMeta}() function meta(::Type{EnumDescriptorProto}) - if !isassigned(__meta_EnumDescriptorProto) - __meta_EnumDescriptorProto[] = target = ProtoMeta(EnumDescriptorProto) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :value => Base.Vector{EnumValueDescriptorProto}, :options => EnumOptions, :reserved_range => Base.Vector{EnumDescriptorProto_EnumReservedRange}, :reserved_name => Base.Vector{AbstractString}] - meta(target, EnumDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_EnumDescriptorProto) + __meta_EnumDescriptorProto[] = target = ProtoMeta(EnumDescriptorProto) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :value => Base.Vector{EnumValueDescriptorProto}, :options => EnumOptions, :reserved_range => Base.Vector{EnumDescriptorProto_EnumReservedRange}, :reserved_name => Base.Vector{AbstractString}] + meta(target, EnumDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_EnumDescriptorProto[] end - __meta_EnumDescriptorProto[] end function Base.getproperty(obj::EnumDescriptorProto, name::Symbol) if name === :name @@ -799,12 +833,14 @@ mutable struct OneofDescriptorProto <: ProtoType end # mutable struct OneofDescriptorProto const __meta_OneofDescriptorProto = Ref{ProtoMeta}() function meta(::Type{OneofDescriptorProto}) - if !isassigned(__meta_OneofDescriptorProto) - __meta_OneofDescriptorProto[] = target = ProtoMeta(OneofDescriptorProto) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :options => OneofOptions] - meta(target, OneofDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_OneofDescriptorProto) + __meta_OneofDescriptorProto[] = target = ProtoMeta(OneofDescriptorProto) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :options => OneofOptions] + meta(target, OneofDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_OneofDescriptorProto[] end - __meta_OneofDescriptorProto[] end function Base.getproperty(obj::OneofDescriptorProto, name::Symbol) if name === :name @@ -835,12 +871,14 @@ mutable struct DescriptorProto_ReservedRange <: ProtoType end # mutable struct DescriptorProto_ReservedRange const __meta_DescriptorProto_ReservedRange = Ref{ProtoMeta}() function meta(::Type{DescriptorProto_ReservedRange}) - if !isassigned(__meta_DescriptorProto_ReservedRange) - __meta_DescriptorProto_ReservedRange[] = target = ProtoMeta(DescriptorProto_ReservedRange) - allflds = Pair{Symbol,Union{Type,String}}[:start => Int32, :_end => Int32] - meta(target, DescriptorProto_ReservedRange, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_DescriptorProto_ReservedRange) + __meta_DescriptorProto_ReservedRange[] = target = ProtoMeta(DescriptorProto_ReservedRange) + allflds = Pair{Symbol,Union{Type,String}}[:start => Int32, :_end => Int32] + meta(target, DescriptorProto_ReservedRange, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_DescriptorProto_ReservedRange[] end - __meta_DescriptorProto_ReservedRange[] end function Base.getproperty(obj::DescriptorProto_ReservedRange, name::Symbol) if name === :start @@ -871,13 +909,15 @@ mutable struct DescriptorProto <: ProtoType end # mutable struct DescriptorProto const __meta_DescriptorProto = Ref{ProtoMeta}() function meta(::Type{DescriptorProto}) - if !isassigned(__meta_DescriptorProto) - __meta_DescriptorProto[] = target = ProtoMeta(DescriptorProto) - fnum = Int[1,2,6,3,4,5,8,7,9,10] - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :field => Base.Vector{FieldDescriptorProto}, :extension => Base.Vector{FieldDescriptorProto}, :nested_type => Base.Vector{DescriptorProto}, :enum_type => Base.Vector{EnumDescriptorProto}, :extension_range => Base.Vector{DescriptorProto_ExtensionRange}, :oneof_decl => Base.Vector{OneofDescriptorProto}, :options => MessageOptions, :reserved_range => Base.Vector{DescriptorProto_ReservedRange}, :reserved_name => Base.Vector{AbstractString}] - meta(target, DescriptorProto, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_DescriptorProto) + __meta_DescriptorProto[] = target = ProtoMeta(DescriptorProto) + fnum = Int[1,2,6,3,4,5,8,7,9,10] + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :field => Base.Vector{FieldDescriptorProto}, :extension => Base.Vector{FieldDescriptorProto}, :nested_type => Base.Vector{DescriptorProto}, :enum_type => Base.Vector{EnumDescriptorProto}, :extension_range => Base.Vector{DescriptorProto_ExtensionRange}, :oneof_decl => Base.Vector{OneofDescriptorProto}, :options => MessageOptions, :reserved_range => Base.Vector{DescriptorProto_ReservedRange}, :reserved_name => Base.Vector{AbstractString}] + meta(target, DescriptorProto, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_DescriptorProto[] end - __meta_DescriptorProto[] end function Base.getproperty(obj::DescriptorProto, name::Symbol) if name === :name @@ -924,12 +964,14 @@ mutable struct ServiceDescriptorProto <: ProtoType end # mutable struct ServiceDescriptorProto const __meta_ServiceDescriptorProto = Ref{ProtoMeta}() function meta(::Type{ServiceDescriptorProto}) - if !isassigned(__meta_ServiceDescriptorProto) - __meta_ServiceDescriptorProto[] = target = ProtoMeta(ServiceDescriptorProto) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :method => Base.Vector{MethodDescriptorProto}, :options => ServiceOptions] - meta(target, ServiceDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_ServiceDescriptorProto) + __meta_ServiceDescriptorProto[] = target = ProtoMeta(ServiceDescriptorProto) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :method => Base.Vector{MethodDescriptorProto}, :options => ServiceOptions] + meta(target, ServiceDescriptorProto, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_ServiceDescriptorProto[] end - __meta_ServiceDescriptorProto[] end function Base.getproperty(obj::ServiceDescriptorProto, name::Symbol) if name === :name @@ -962,14 +1004,16 @@ mutable struct SourceCodeInfo_Location <: ProtoType end # mutable struct SourceCodeInfo_Location const __meta_SourceCodeInfo_Location = Ref{ProtoMeta}() function meta(::Type{SourceCodeInfo_Location}) - if !isassigned(__meta_SourceCodeInfo_Location) - __meta_SourceCodeInfo_Location[] = target = ProtoMeta(SourceCodeInfo_Location) - fnum = Int[1,2,3,4,6] - pack = Symbol[:path,:span] - allflds = Pair{Symbol,Union{Type,String}}[:path => Base.Vector{Int32}, :span => Base.Vector{Int32}, :leading_comments => AbstractString, :trailing_comments => AbstractString, :leading_detached_comments => Base.Vector{AbstractString}] - meta(target, SourceCodeInfo_Location, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, pack, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) - end - __meta_SourceCodeInfo_Location[] + ProtoBuf.metalock() do + if !isassigned(__meta_SourceCodeInfo_Location) + __meta_SourceCodeInfo_Location[] = target = ProtoMeta(SourceCodeInfo_Location) + fnum = Int[1,2,3,4,6] + pack = Symbol[:path,:span] + allflds = Pair{Symbol,Union{Type,String}}[:path => Base.Vector{Int32}, :span => Base.Vector{Int32}, :leading_comments => AbstractString, :trailing_comments => AbstractString, :leading_detached_comments => Base.Vector{AbstractString}] + meta(target, SourceCodeInfo_Location, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, pack, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_SourceCodeInfo_Location[] + end end function Base.getproperty(obj::SourceCodeInfo_Location, name::Symbol) if name === :path @@ -1006,12 +1050,14 @@ mutable struct SourceCodeInfo <: ProtoType end # mutable struct SourceCodeInfo const __meta_SourceCodeInfo = Ref{ProtoMeta}() function meta(::Type{SourceCodeInfo}) - if !isassigned(__meta_SourceCodeInfo) - __meta_SourceCodeInfo[] = target = ProtoMeta(SourceCodeInfo) - allflds = Pair{Symbol,Union{Type,String}}[:location => Base.Vector{SourceCodeInfo_Location}] - meta(target, SourceCodeInfo, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_SourceCodeInfo) + __meta_SourceCodeInfo[] = target = ProtoMeta(SourceCodeInfo) + allflds = Pair{Symbol,Union{Type,String}}[:location => Base.Vector{SourceCodeInfo_Location}] + meta(target, SourceCodeInfo, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_SourceCodeInfo[] end - __meta_SourceCodeInfo[] end function Base.getproperty(obj::SourceCodeInfo, name::Symbol) if name === :location @@ -1040,13 +1086,15 @@ mutable struct FileDescriptorProto <: ProtoType end # mutable struct FileDescriptorProto const __meta_FileDescriptorProto = Ref{ProtoMeta}() function meta(::Type{FileDescriptorProto}) - if !isassigned(__meta_FileDescriptorProto) - __meta_FileDescriptorProto[] = target = ProtoMeta(FileDescriptorProto) - fnum = Int[1,2,3,10,11,4,5,6,7,8,9,12] - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :package => AbstractString, :dependency => Base.Vector{AbstractString}, :public_dependency => Base.Vector{Int32}, :weak_dependency => Base.Vector{Int32}, :message_type => Base.Vector{DescriptorProto}, :enum_type => Base.Vector{EnumDescriptorProto}, :service => Base.Vector{ServiceDescriptorProto}, :extension => Base.Vector{FieldDescriptorProto}, :options => FileOptions, :source_code_info => SourceCodeInfo, :syntax => AbstractString] - meta(target, FileDescriptorProto, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_FileDescriptorProto) + __meta_FileDescriptorProto[] = target = ProtoMeta(FileDescriptorProto) + fnum = Int[1,2,3,10,11,4,5,6,7,8,9,12] + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :package => AbstractString, :dependency => Base.Vector{AbstractString}, :public_dependency => Base.Vector{Int32}, :weak_dependency => Base.Vector{Int32}, :message_type => Base.Vector{DescriptorProto}, :enum_type => Base.Vector{EnumDescriptorProto}, :service => Base.Vector{ServiceDescriptorProto}, :extension => Base.Vector{FieldDescriptorProto}, :options => FileOptions, :source_code_info => SourceCodeInfo, :syntax => AbstractString] + meta(target, FileDescriptorProto, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_FileDescriptorProto[] end - __meta_FileDescriptorProto[] end function Base.getproperty(obj::FileDescriptorProto, name::Symbol) if name === :name @@ -1097,12 +1145,14 @@ mutable struct FileDescriptorSet <: ProtoType end # mutable struct FileDescriptorSet const __meta_FileDescriptorSet = Ref{ProtoMeta}() function meta(::Type{FileDescriptorSet}) - if !isassigned(__meta_FileDescriptorSet) - __meta_FileDescriptorSet[] = target = ProtoMeta(FileDescriptorSet) - allflds = Pair{Symbol,Union{Type,String}}[:file => Base.Vector{FileDescriptorProto}] - meta(target, FileDescriptorSet, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_FileDescriptorSet) + __meta_FileDescriptorSet[] = target = ProtoMeta(FileDescriptorSet) + allflds = Pair{Symbol,Union{Type,String}}[:file => Base.Vector{FileDescriptorProto}] + meta(target, FileDescriptorSet, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_FileDescriptorSet[] end - __meta_FileDescriptorSet[] end function Base.getproperty(obj::FileDescriptorSet, name::Symbol) if name === :file @@ -1131,13 +1181,15 @@ mutable struct GeneratedCodeInfo_Annotation <: ProtoType end # mutable struct GeneratedCodeInfo_Annotation const __meta_GeneratedCodeInfo_Annotation = Ref{ProtoMeta}() function meta(::Type{GeneratedCodeInfo_Annotation}) - if !isassigned(__meta_GeneratedCodeInfo_Annotation) - __meta_GeneratedCodeInfo_Annotation[] = target = ProtoMeta(GeneratedCodeInfo_Annotation) - pack = Symbol[:path] - allflds = Pair{Symbol,Union{Type,String}}[:path => Base.Vector{Int32}, :source_file => AbstractString, :_begin => Int32, :_end => Int32] - meta(target, GeneratedCodeInfo_Annotation, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, pack, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_GeneratedCodeInfo_Annotation) + __meta_GeneratedCodeInfo_Annotation[] = target = ProtoMeta(GeneratedCodeInfo_Annotation) + pack = Symbol[:path] + allflds = Pair{Symbol,Union{Type,String}}[:path => Base.Vector{Int32}, :source_file => AbstractString, :_begin => Int32, :_end => Int32] + meta(target, GeneratedCodeInfo_Annotation, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, pack, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_GeneratedCodeInfo_Annotation[] end - __meta_GeneratedCodeInfo_Annotation[] end function Base.getproperty(obj::GeneratedCodeInfo_Annotation, name::Symbol) if name === :path @@ -1172,12 +1224,14 @@ mutable struct GeneratedCodeInfo <: ProtoType end # mutable struct GeneratedCodeInfo const __meta_GeneratedCodeInfo = Ref{ProtoMeta}() function meta(::Type{GeneratedCodeInfo}) - if !isassigned(__meta_GeneratedCodeInfo) - __meta_GeneratedCodeInfo[] = target = ProtoMeta(GeneratedCodeInfo) - allflds = Pair{Symbol,Union{Type,String}}[:annotation => Base.Vector{GeneratedCodeInfo_Annotation}] - meta(target, GeneratedCodeInfo, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_GeneratedCodeInfo) + __meta_GeneratedCodeInfo[] = target = ProtoMeta(GeneratedCodeInfo) + allflds = Pair{Symbol,Union{Type,String}}[:annotation => Base.Vector{GeneratedCodeInfo_Annotation}] + meta(target, GeneratedCodeInfo, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_GeneratedCodeInfo[] end - __meta_GeneratedCodeInfo[] end function Base.getproperty(obj::GeneratedCodeInfo, name::Symbol) if name === :annotation diff --git a/src/google/duration_pb.jl b/src/google/duration_pb.jl index 50520fe..4dd292b 100644 --- a/src/google/duration_pb.jl +++ b/src/google/duration_pb.jl @@ -18,12 +18,14 @@ mutable struct Duration <: ProtoType end # mutable struct Duration const __meta_Duration = Ref{ProtoMeta}() function meta(::Type{Duration}) - if !isassigned(__meta_Duration) - __meta_Duration[] = target = ProtoMeta(Duration) - allflds = Pair{Symbol,Union{Type,String}}[:seconds => Int64, :nanos => Int32] - meta(target, Duration, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Duration) + __meta_Duration[] = target = ProtoMeta(Duration) + allflds = Pair{Symbol,Union{Type,String}}[:seconds => Int64, :nanos => Int32] + meta(target, Duration, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Duration[] end - __meta_Duration[] end function Base.getproperty(obj::Duration, name::Symbol) if name === :seconds diff --git a/src/google/empty_pb.jl b/src/google/empty_pb.jl index 1907eab..a89d2ba 100644 --- a/src/google/empty_pb.jl +++ b/src/google/empty_pb.jl @@ -18,12 +18,14 @@ mutable struct Empty <: ProtoType end # mutable struct Empty const __meta_Empty = Ref{ProtoMeta}() function meta(::Type{Empty}) - if !isassigned(__meta_Empty) - __meta_Empty[] = target = ProtoMeta(Empty) - allflds = Pair{Symbol,Union{Type,String}}[] - meta(target, Empty, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Empty) + __meta_Empty[] = target = ProtoMeta(Empty) + allflds = Pair{Symbol,Union{Type,String}}[] + meta(target, Empty, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Empty[] end - __meta_Empty[] end export Empty diff --git a/src/google/field_mask_pb.jl b/src/google/field_mask_pb.jl index e9ff90d..8ad258e 100644 --- a/src/google/field_mask_pb.jl +++ b/src/google/field_mask_pb.jl @@ -18,12 +18,14 @@ mutable struct FieldMask <: ProtoType end # mutable struct FieldMask const __meta_FieldMask = Ref{ProtoMeta}() function meta(::Type{FieldMask}) - if !isassigned(__meta_FieldMask) - __meta_FieldMask[] = target = ProtoMeta(FieldMask) - allflds = Pair{Symbol,Union{Type,String}}[:paths => Base.Vector{AbstractString}] - meta(target, FieldMask, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_FieldMask) + __meta_FieldMask[] = target = ProtoMeta(FieldMask) + allflds = Pair{Symbol,Union{Type,String}}[:paths => Base.Vector{AbstractString}] + meta(target, FieldMask, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_FieldMask[] end - __meta_FieldMask[] end function Base.getproperty(obj::FieldMask, name::Symbol) if name === :paths diff --git a/src/google/plugin_pb.jl b/src/google/plugin_pb.jl index a108771..00c49f0 100644 --- a/src/google/plugin_pb.jl +++ b/src/google/plugin_pb.jl @@ -18,12 +18,14 @@ mutable struct Version <: ProtoType end # mutable struct Version const __meta_Version = Ref{ProtoMeta}() function meta(::Type{Version}) - if !isassigned(__meta_Version) - __meta_Version[] = target = ProtoMeta(Version) - allflds = Pair{Symbol,Union{Type,String}}[:major => Int32, :minor => Int32, :patch => Int32, :suffix => AbstractString] - meta(target, Version, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Version) + __meta_Version[] = target = ProtoMeta(Version) + allflds = Pair{Symbol,Union{Type,String}}[:major => Int32, :minor => Int32, :patch => Int32, :suffix => AbstractString] + meta(target, Version, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Version[] end - __meta_Version[] end function Base.getproperty(obj::Version, name::Symbol) if name === :major @@ -58,13 +60,15 @@ mutable struct CodeGeneratorRequest <: ProtoType end # mutable struct CodeGeneratorRequest const __meta_CodeGeneratorRequest = Ref{ProtoMeta}() function meta(::Type{CodeGeneratorRequest}) - if !isassigned(__meta_CodeGeneratorRequest) - __meta_CodeGeneratorRequest[] = target = ProtoMeta(CodeGeneratorRequest) - fnum = Int[1,2,15,3] - allflds = Pair{Symbol,Union{Type,String}}[:file_to_generate => Base.Vector{AbstractString}, :parameter => AbstractString, :proto_file => Base.Vector{ProtoBuf.GoogleProtoBuf.FileDescriptorProto}, :compiler_version => Version] - meta(target, CodeGeneratorRequest, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_CodeGeneratorRequest) + __meta_CodeGeneratorRequest[] = target = ProtoMeta(CodeGeneratorRequest) + fnum = Int[1,2,15,3] + allflds = Pair{Symbol,Union{Type,String}}[:file_to_generate => Base.Vector{AbstractString}, :parameter => AbstractString, :proto_file => Base.Vector{ProtoBuf.GoogleProtoBuf.FileDescriptorProto}, :compiler_version => Version] + meta(target, CodeGeneratorRequest, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_CodeGeneratorRequest[] end - __meta_CodeGeneratorRequest[] end function Base.getproperty(obj::CodeGeneratorRequest, name::Symbol) if name === :file_to_generate @@ -99,13 +103,15 @@ mutable struct CodeGeneratorResponse_File <: ProtoType end # mutable struct CodeGeneratorResponse_File const __meta_CodeGeneratorResponse_File = Ref{ProtoMeta}() function meta(::Type{CodeGeneratorResponse_File}) - if !isassigned(__meta_CodeGeneratorResponse_File) - __meta_CodeGeneratorResponse_File[] = target = ProtoMeta(CodeGeneratorResponse_File) - fnum = Int[1,2,15] - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :insertion_point => AbstractString, :content => AbstractString] - meta(target, CodeGeneratorResponse_File, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_CodeGeneratorResponse_File) + __meta_CodeGeneratorResponse_File[] = target = ProtoMeta(CodeGeneratorResponse_File) + fnum = Int[1,2,15] + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :insertion_point => AbstractString, :content => AbstractString] + meta(target, CodeGeneratorResponse_File, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_CodeGeneratorResponse_File[] end - __meta_CodeGeneratorResponse_File[] end function Base.getproperty(obj::CodeGeneratorResponse_File, name::Symbol) if name === :name @@ -138,13 +144,15 @@ mutable struct CodeGeneratorResponse <: ProtoType end # mutable struct CodeGeneratorResponse const __meta_CodeGeneratorResponse = Ref{ProtoMeta}() function meta(::Type{CodeGeneratorResponse}) - if !isassigned(__meta_CodeGeneratorResponse) - __meta_CodeGeneratorResponse[] = target = ProtoMeta(CodeGeneratorResponse) - fnum = Int[1,15] - allflds = Pair{Symbol,Union{Type,String}}[:error => AbstractString, :file => Base.Vector{CodeGeneratorResponse_File}] - meta(target, CodeGeneratorResponse, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_CodeGeneratorResponse) + __meta_CodeGeneratorResponse[] = target = ProtoMeta(CodeGeneratorResponse) + fnum = Int[1,15] + allflds = Pair{Symbol,Union{Type,String}}[:error => AbstractString, :file => Base.Vector{CodeGeneratorResponse_File}] + meta(target, CodeGeneratorResponse, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_CodeGeneratorResponse[] end - __meta_CodeGeneratorResponse[] end function Base.getproperty(obj::CodeGeneratorResponse, name::Symbol) if name === :error diff --git a/src/google/source_context_pb.jl b/src/google/source_context_pb.jl index 17c03c9..d6a43ea 100644 --- a/src/google/source_context_pb.jl +++ b/src/google/source_context_pb.jl @@ -18,12 +18,14 @@ mutable struct SourceContext <: ProtoType end # mutable struct SourceContext const __meta_SourceContext = Ref{ProtoMeta}() function meta(::Type{SourceContext}) - if !isassigned(__meta_SourceContext) - __meta_SourceContext[] = target = ProtoMeta(SourceContext) - allflds = Pair{Symbol,Union{Type,String}}[:file_name => AbstractString] - meta(target, SourceContext, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_SourceContext) + __meta_SourceContext[] = target = ProtoMeta(SourceContext) + allflds = Pair{Symbol,Union{Type,String}}[:file_name => AbstractString] + meta(target, SourceContext, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_SourceContext[] end - __meta_SourceContext[] end function Base.getproperty(obj::SourceContext, name::Symbol) if name === :file_name diff --git a/src/google/struct_pb.jl b/src/google/struct_pb.jl index f8232a7..d2cc0a7 100644 --- a/src/google/struct_pb.jl +++ b/src/google/struct_pb.jl @@ -22,12 +22,14 @@ mutable struct Struct_FieldsEntry <: ProtoType end # mutable struct Struct_FieldsEntry (mapentry) (has cyclic type dependency) const __meta_Struct_FieldsEntry = Ref{ProtoMeta}() function meta(::Type{Struct_FieldsEntry}) - if !isassigned(__meta_Struct_FieldsEntry) - __meta_Struct_FieldsEntry[] = target = ProtoMeta(Struct_FieldsEntry) - allflds = Pair{Symbol,Union{Type,String}}[:key => AbstractString, :value => "Value"] - meta(target, Struct_FieldsEntry, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Struct_FieldsEntry) + __meta_Struct_FieldsEntry[] = target = ProtoMeta(Struct_FieldsEntry) + allflds = Pair{Symbol,Union{Type,String}}[:key => AbstractString, :value => "Value"] + meta(target, Struct_FieldsEntry, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Struct_FieldsEntry[] end - __meta_Struct_FieldsEntry[] end function Base.getproperty(obj::Struct_FieldsEntry, name::Symbol) if name === :key @@ -58,12 +60,14 @@ mutable struct Struct <: ProtoType end # mutable struct Struct (has cyclic type dependency) const __meta_Struct = Ref{ProtoMeta}() function meta(::Type{Struct}) - if !isassigned(__meta_Struct) - __meta_Struct[] = target = ProtoMeta(Struct) - allflds = Pair{Symbol,Union{Type,String}}[:fields => "Base.Dict{AbstractString,Value}"] - meta(target, Struct, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Struct) + __meta_Struct[] = target = ProtoMeta(Struct) + allflds = Pair{Symbol,Union{Type,String}}[:fields => "Base.Dict{AbstractString,Value}"] + meta(target, Struct, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Struct[] end - __meta_Struct[] end function Base.getproperty(obj::Struct, name::Symbol) if name === :fields @@ -92,14 +96,16 @@ mutable struct Value <: ProtoType end # mutable struct Value (has cyclic type dependency) const __meta_Value = Ref{ProtoMeta}() function meta(::Type{Value}) - if !isassigned(__meta_Value) - __meta_Value[] = target = ProtoMeta(Value) - allflds = Pair{Symbol,Union{Type,String}}[:null_value => Int32, :number_value => Float64, :string_value => AbstractString, :bool_value => Bool, :struct_value => Struct, :list_value => "ListValue"] - oneofs = Int[1,1,1,1,1,1] - oneof_names = Symbol[Symbol("kind")] - meta(target, Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, oneofs, oneof_names) + ProtoBuf.metalock() do + if !isassigned(__meta_Value) + __meta_Value[] = target = ProtoMeta(Value) + allflds = Pair{Symbol,Union{Type,String}}[:null_value => Int32, :number_value => Float64, :string_value => AbstractString, :bool_value => Bool, :struct_value => Struct, :list_value => "ListValue"] + oneofs = Int[1,1,1,1,1,1] + oneof_names = Symbol[Symbol("kind")] + meta(target, Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, oneofs, oneof_names) + end + __meta_Value[] end - __meta_Value[] end function Base.getproperty(obj::Value, name::Symbol) if name === :null_value @@ -138,12 +144,14 @@ mutable struct ListValue <: ProtoType end # mutable struct ListValue (has cyclic type dependency) const __meta_ListValue = Ref{ProtoMeta}() function meta(::Type{ListValue}) - if !isassigned(__meta_ListValue) - __meta_ListValue[] = target = ProtoMeta(ListValue) - allflds = Pair{Symbol,Union{Type,String}}[:values => Base.Vector{Value}] - meta(target, ListValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_ListValue) + __meta_ListValue[] = target = ProtoMeta(ListValue) + allflds = Pair{Symbol,Union{Type,String}}[:values => Base.Vector{Value}] + meta(target, ListValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_ListValue[] end - __meta_ListValue[] end function Base.getproperty(obj::ListValue, name::Symbol) if name === :values diff --git a/src/google/timestamp_pb.jl b/src/google/timestamp_pb.jl index 7478fb8..aa2ba51 100644 --- a/src/google/timestamp_pb.jl +++ b/src/google/timestamp_pb.jl @@ -18,12 +18,14 @@ mutable struct Timestamp <: ProtoType end # mutable struct Timestamp const __meta_Timestamp = Ref{ProtoMeta}() function meta(::Type{Timestamp}) - if !isassigned(__meta_Timestamp) - __meta_Timestamp[] = target = ProtoMeta(Timestamp) - allflds = Pair{Symbol,Union{Type,String}}[:seconds => Int64, :nanos => Int32] - meta(target, Timestamp, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Timestamp) + __meta_Timestamp[] = target = ProtoMeta(Timestamp) + allflds = Pair{Symbol,Union{Type,String}}[:seconds => Int64, :nanos => Int32] + meta(target, Timestamp, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Timestamp[] end - __meta_Timestamp[] end function Base.getproperty(obj::Timestamp, name::Symbol) if name === :seconds diff --git a/src/google/type_pb.jl b/src/google/type_pb.jl index 6148a03..309aa5b 100644 --- a/src/google/type_pb.jl +++ b/src/google/type_pb.jl @@ -23,12 +23,14 @@ mutable struct Option <: ProtoType end # mutable struct Option const __meta_Option = Ref{ProtoMeta}() function meta(::Type{Option}) - if !isassigned(__meta_Option) - __meta_Option[] = target = ProtoMeta(Option) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :value => _Any] - meta(target, Option, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Option) + __meta_Option[] = target = ProtoMeta(Option) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :value => _Any] + meta(target, Option, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Option[] end - __meta_Option[] end function Base.getproperty(obj::Option, name::Symbol) if name === :name @@ -59,12 +61,14 @@ mutable struct EnumValue <: ProtoType end # mutable struct EnumValue const __meta_EnumValue = Ref{ProtoMeta}() function meta(::Type{EnumValue}) - if !isassigned(__meta_EnumValue) - __meta_EnumValue[] = target = ProtoMeta(EnumValue) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :number => Int32, :options => Base.Vector{Option}] - meta(target, EnumValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_EnumValue) + __meta_EnumValue[] = target = ProtoMeta(EnumValue) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :number => Int32, :options => Base.Vector{Option}] + meta(target, EnumValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_EnumValue[] end - __meta_EnumValue[] end function Base.getproperty(obj::EnumValue, name::Symbol) if name === :name @@ -126,13 +130,15 @@ mutable struct Field <: ProtoType end # mutable struct Field const __meta_Field = Ref{ProtoMeta}() function meta(::Type{Field}) - if !isassigned(__meta_Field) - __meta_Field[] = target = ProtoMeta(Field) - fnum = Int[1,2,3,4,6,7,8,9,10,11] - allflds = Pair{Symbol,Union{Type,String}}[:kind => Int32, :cardinality => Int32, :number => Int32, :name => AbstractString, :type_url => AbstractString, :oneof_index => Int32, :packed => Bool, :options => Base.Vector{Option}, :json_name => AbstractString, :default_value => AbstractString] - meta(target, Field, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Field) + __meta_Field[] = target = ProtoMeta(Field) + fnum = Int[1,2,3,4,6,7,8,9,10,11] + allflds = Pair{Symbol,Union{Type,String}}[:kind => Int32, :cardinality => Int32, :number => Int32, :name => AbstractString, :type_url => AbstractString, :oneof_index => Int32, :packed => Bool, :options => Base.Vector{Option}, :json_name => AbstractString, :default_value => AbstractString] + meta(target, Field, allflds, ProtoBuf.DEF_REQ, fnum, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Field[] end - __meta_Field[] end function Base.getproperty(obj::Field, name::Symbol) if name === :kind @@ -179,12 +185,14 @@ mutable struct _Enum <: ProtoType end # mutable struct _Enum const __meta__Enum = Ref{ProtoMeta}() function meta(::Type{_Enum}) - if !isassigned(__meta__Enum) - __meta__Enum[] = target = ProtoMeta(_Enum) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :enumvalue => Base.Vector{EnumValue}, :options => Base.Vector{Option}, :source_context => SourceContext, :syntax => Int32] - meta(target, _Enum, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta__Enum) + __meta__Enum[] = target = ProtoMeta(_Enum) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :enumvalue => Base.Vector{EnumValue}, :options => Base.Vector{Option}, :source_context => SourceContext, :syntax => Int32] + meta(target, _Enum, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta__Enum[] end - __meta__Enum[] end function Base.getproperty(obj::_Enum, name::Symbol) if name === :name @@ -221,12 +229,14 @@ mutable struct _Type <: ProtoType end # mutable struct _Type const __meta__Type = Ref{ProtoMeta}() function meta(::Type{_Type}) - if !isassigned(__meta__Type) - __meta__Type[] = target = ProtoMeta(_Type) - allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :fields => Base.Vector{Field}, :oneofs => Base.Vector{AbstractString}, :options => Base.Vector{Option}, :source_context => SourceContext, :syntax => Int32] - meta(target, _Type, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta__Type) + __meta__Type[] = target = ProtoMeta(_Type) + allflds = Pair{Symbol,Union{Type,String}}[:name => AbstractString, :fields => Base.Vector{Field}, :oneofs => Base.Vector{AbstractString}, :options => Base.Vector{Option}, :source_context => SourceContext, :syntax => Int32] + meta(target, _Type, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta__Type[] end - __meta__Type[] end function Base.getproperty(obj::_Type, name::Symbol) if name === :name diff --git a/src/google/wrappers_pb.jl b/src/google/wrappers_pb.jl index cd4b499..6a1c790 100644 --- a/src/google/wrappers_pb.jl +++ b/src/google/wrappers_pb.jl @@ -18,12 +18,14 @@ mutable struct DoubleValue <: ProtoType end # mutable struct DoubleValue const __meta_DoubleValue = Ref{ProtoMeta}() function meta(::Type{DoubleValue}) - if !isassigned(__meta_DoubleValue) - __meta_DoubleValue[] = target = ProtoMeta(DoubleValue) - allflds = Pair{Symbol,Union{Type,String}}[:value => Float64] - meta(target, DoubleValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_DoubleValue) + __meta_DoubleValue[] = target = ProtoMeta(DoubleValue) + allflds = Pair{Symbol,Union{Type,String}}[:value => Float64] + meta(target, DoubleValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_DoubleValue[] end - __meta_DoubleValue[] end function Base.getproperty(obj::DoubleValue, name::Symbol) if name === :value @@ -52,12 +54,14 @@ mutable struct FloatValue <: ProtoType end # mutable struct FloatValue const __meta_FloatValue = Ref{ProtoMeta}() function meta(::Type{FloatValue}) - if !isassigned(__meta_FloatValue) - __meta_FloatValue[] = target = ProtoMeta(FloatValue) - allflds = Pair{Symbol,Union{Type,String}}[:value => Float32] - meta(target, FloatValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_FloatValue) + __meta_FloatValue[] = target = ProtoMeta(FloatValue) + allflds = Pair{Symbol,Union{Type,String}}[:value => Float32] + meta(target, FloatValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_FloatValue[] end - __meta_FloatValue[] end function Base.getproperty(obj::FloatValue, name::Symbol) if name === :value @@ -86,12 +90,14 @@ mutable struct Int64Value <: ProtoType end # mutable struct Int64Value const __meta_Int64Value = Ref{ProtoMeta}() function meta(::Type{Int64Value}) - if !isassigned(__meta_Int64Value) - __meta_Int64Value[] = target = ProtoMeta(Int64Value) - allflds = Pair{Symbol,Union{Type,String}}[:value => Int64] - meta(target, Int64Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Int64Value) + __meta_Int64Value[] = target = ProtoMeta(Int64Value) + allflds = Pair{Symbol,Union{Type,String}}[:value => Int64] + meta(target, Int64Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Int64Value[] end - __meta_Int64Value[] end function Base.getproperty(obj::Int64Value, name::Symbol) if name === :value @@ -120,12 +126,14 @@ mutable struct UInt64Value <: ProtoType end # mutable struct UInt64Value const __meta_UInt64Value = Ref{ProtoMeta}() function meta(::Type{UInt64Value}) - if !isassigned(__meta_UInt64Value) - __meta_UInt64Value[] = target = ProtoMeta(UInt64Value) - allflds = Pair{Symbol,Union{Type,String}}[:value => UInt64] - meta(target, UInt64Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_UInt64Value) + __meta_UInt64Value[] = target = ProtoMeta(UInt64Value) + allflds = Pair{Symbol,Union{Type,String}}[:value => UInt64] + meta(target, UInt64Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_UInt64Value[] end - __meta_UInt64Value[] end function Base.getproperty(obj::UInt64Value, name::Symbol) if name === :value @@ -154,12 +162,14 @@ mutable struct Int32Value <: ProtoType end # mutable struct Int32Value const __meta_Int32Value = Ref{ProtoMeta}() function meta(::Type{Int32Value}) - if !isassigned(__meta_Int32Value) - __meta_Int32Value[] = target = ProtoMeta(Int32Value) - allflds = Pair{Symbol,Union{Type,String}}[:value => Int32] - meta(target, Int32Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_Int32Value) + __meta_Int32Value[] = target = ProtoMeta(Int32Value) + allflds = Pair{Symbol,Union{Type,String}}[:value => Int32] + meta(target, Int32Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_Int32Value[] end - __meta_Int32Value[] end function Base.getproperty(obj::Int32Value, name::Symbol) if name === :value @@ -188,12 +198,14 @@ mutable struct UInt32Value <: ProtoType end # mutable struct UInt32Value const __meta_UInt32Value = Ref{ProtoMeta}() function meta(::Type{UInt32Value}) - if !isassigned(__meta_UInt32Value) - __meta_UInt32Value[] = target = ProtoMeta(UInt32Value) - allflds = Pair{Symbol,Union{Type,String}}[:value => UInt32] - meta(target, UInt32Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_UInt32Value) + __meta_UInt32Value[] = target = ProtoMeta(UInt32Value) + allflds = Pair{Symbol,Union{Type,String}}[:value => UInt32] + meta(target, UInt32Value, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_UInt32Value[] end - __meta_UInt32Value[] end function Base.getproperty(obj::UInt32Value, name::Symbol) if name === :value @@ -222,12 +234,14 @@ mutable struct BoolValue <: ProtoType end # mutable struct BoolValue const __meta_BoolValue = Ref{ProtoMeta}() function meta(::Type{BoolValue}) - if !isassigned(__meta_BoolValue) - __meta_BoolValue[] = target = ProtoMeta(BoolValue) - allflds = Pair{Symbol,Union{Type,String}}[:value => Bool] - meta(target, BoolValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_BoolValue) + __meta_BoolValue[] = target = ProtoMeta(BoolValue) + allflds = Pair{Symbol,Union{Type,String}}[:value => Bool] + meta(target, BoolValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_BoolValue[] end - __meta_BoolValue[] end function Base.getproperty(obj::BoolValue, name::Symbol) if name === :value @@ -256,12 +270,14 @@ mutable struct StringValue <: ProtoType end # mutable struct StringValue const __meta_StringValue = Ref{ProtoMeta}() function meta(::Type{StringValue}) - if !isassigned(__meta_StringValue) - __meta_StringValue[] = target = ProtoMeta(StringValue) - allflds = Pair{Symbol,Union{Type,String}}[:value => AbstractString] - meta(target, StringValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_StringValue) + __meta_StringValue[] = target = ProtoMeta(StringValue) + allflds = Pair{Symbol,Union{Type,String}}[:value => AbstractString] + meta(target, StringValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_StringValue[] end - __meta_StringValue[] end function Base.getproperty(obj::StringValue, name::Symbol) if name === :value @@ -290,12 +306,14 @@ mutable struct BytesValue <: ProtoType end # mutable struct BytesValue const __meta_BytesValue = Ref{ProtoMeta}() function meta(::Type{BytesValue}) - if !isassigned(__meta_BytesValue) - __meta_BytesValue[] = target = ProtoMeta(BytesValue) - allflds = Pair{Symbol,Union{Type,String}}[:value => Array{UInt8,1}] - meta(target, BytesValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + ProtoBuf.metalock() do + if !isassigned(__meta_BytesValue) + __meta_BytesValue[] = target = ProtoMeta(BytesValue) + allflds = Pair{Symbol,Union{Type,String}}[:value => Array{UInt8,1}] + meta(target, BytesValue, allflds, ProtoBuf.DEF_REQ, ProtoBuf.DEF_FNUM, ProtoBuf.DEF_VAL, ProtoBuf.DEF_PACK, ProtoBuf.DEF_WTYPES, ProtoBuf.DEF_ONEOFS, ProtoBuf.DEF_ONEOF_NAMES) + end + __meta_BytesValue[] end - __meta_BytesValue[] end function Base.getproperty(obj::BytesValue, name::Symbol) if name === :value diff --git a/test/runtests.jl b/test/runtests.jl index 0181d54..0852640 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using ProtoBuf, Test +include("testmetalock.jl") include("testtypevers.jl") include("testutilapi.jl") include("testwellknown.jl") diff --git a/test/testmetalock.jl b/test/testmetalock.jl new file mode 100644 index 0000000..b95117d --- /dev/null +++ b/test/testmetalock.jl @@ -0,0 +1,15 @@ +using ProtoBuf +import ProtoBuf.meta + +function testmetalock() + println("testing metadata generation locking...") + current_async_safety = ProtoBuf.MetaLock.lck !== nothing + for async_safety in (true, false) + ProtoBuf.enable_async_safety(async_safety) + ProtoBuf.metalock() do + "test with lock enabled $async_safety" + end + end + ProtoBuf.enable_async_safety(current_async_safety) + nothing +end \ No newline at end of file