Integrate review feedback

This commit is contained in:
Dominik Charousset 2024-01-06 13:48:14 +01:00
parent 6132cbd13e
commit bd3e5bedbb
7 changed files with 23 additions and 22 deletions

View file

@ -94,7 +94,7 @@ private:
/**
* Legacy macro to insert into an OpaqueVal-derived class's declaration. Overrides the "old" serialization methods
* DoSerialize and DoUnserialize.
* @deprecated Use DECLARE_OPAQUE_VALUE_V2 instead.
* @deprecated Use DECLARE_OPAQUE_VALUE_DATA instead.
*/
#define DECLARE_OPAQUE_VALUE(T) \
friend class zeek::OpaqueMgr::Register<T>; \
@ -108,7 +108,7 @@ private:
* Macro to insert into an OpaqueVal-derived class's declaration. Overrides the "new" serialization methods
* DoSerializeData and DoUnserializeData.
*/
#define DECLARE_OPAQUE_VALUE_V2(T) \
#define DECLARE_OPAQUE_VALUE_DATA(T) \
friend class zeek::OpaqueMgr::Register<T>; \
friend zeek::IntrusivePtr<T> zeek::make_intrusive<T>(); \
std::optional<zeek::BrokerData> DoSerializeData() const override; \
@ -138,7 +138,7 @@ public:
* @return the broker representation, or an error if serialization
* isn't supported or failed.
*/
[[deprecated("use SerializeData instead")]] broker::expected<broker::data> Serialize() const;
[[deprecated("Remove in v7.1: use SerializeData instead")]] broker::expected<broker::data> Serialize() const;
/**
* @copydoc Serialize
@ -151,7 +151,8 @@ public:
* @param data Broker representation as returned by *Serialize()*.
* @return unserialized instances with reference count at +1
*/
[[deprecated("use UnserializeData instead")]] static OpaqueValPtr Unserialize(const broker::data& data);
[[deprecated("Remove in v7.1: use UnserializeData instead")]] static OpaqueValPtr Unserialize(
const broker::data& data);
/**
* @copydoc Unserialize
@ -289,7 +290,7 @@ protected:
bool DoFeed(const void* data, size_t size) override;
StringValPtr DoGet() override;
DECLARE_OPAQUE_VALUE_V2(MD5Val)
DECLARE_OPAQUE_VALUE_DATA(MD5Val)
private:
StatePtr ctx = nullptr;
};
@ -317,7 +318,7 @@ protected:
bool DoFeed(const void* data, size_t size) override;
StringValPtr DoGet() override;
DECLARE_OPAQUE_VALUE_V2(SHA1Val)
DECLARE_OPAQUE_VALUE_DATA(SHA1Val)
private:
StatePtr ctx = nullptr;
};
@ -345,7 +346,7 @@ protected:
bool DoFeed(const void* data, size_t size) override;
StringValPtr DoGet() override;
DECLARE_OPAQUE_VALUE_V2(SHA256Val)
DECLARE_OPAQUE_VALUE_DATA(SHA256Val)
private:
StatePtr ctx = nullptr;
};
@ -360,7 +361,7 @@ public:
protected:
friend class Val;
DECLARE_OPAQUE_VALUE_V2(EntropyVal)
DECLARE_OPAQUE_VALUE_DATA(EntropyVal)
private:
detail::RandTest state;
};
@ -390,7 +391,7 @@ protected:
friend class Val;
BloomFilterVal();
DECLARE_OPAQUE_VALUE_V2(BloomFilterVal)
DECLARE_OPAQUE_VALUE_DATA(BloomFilterVal)
private:
// Disable.
BloomFilterVal(const BloomFilterVal&);
@ -419,7 +420,7 @@ public:
protected:
CardinalityVal();
DECLARE_OPAQUE_VALUE_V2(CardinalityVal)
DECLARE_OPAQUE_VALUE_DATA(CardinalityVal)
private:
TypePtr type;
detail::CompositeHash* hash;
@ -436,7 +437,7 @@ public:
protected:
ParaglobVal() : OpaqueVal(paraglob_type) {}
DECLARE_OPAQUE_VALUE_V2(ParaglobVal)
DECLARE_OPAQUE_VALUE_DATA(ParaglobVal)
private:
std::unique_ptr<paraglob::Paraglob> internal_paraglob;

View file

@ -125,7 +125,7 @@ public:
protected:
DataVal() : OpaqueVal(opaque_of_data_type) {}
DECLARE_OPAQUE_VALUE_V2(zeek::Broker::detail::DataVal)
DECLARE_OPAQUE_VALUE_DATA(zeek::Broker::detail::DataVal)
};
/**
@ -222,7 +222,7 @@ public:
protected:
SetIterator() : zeek::OpaqueVal(opaque_of_set_iterator) {}
DECLARE_OPAQUE_VALUE_V2(zeek::Broker::detail::SetIterator)
DECLARE_OPAQUE_VALUE_DATA(zeek::Broker::detail::SetIterator)
};
class TableIterator : public zeek::OpaqueVal {
@ -238,7 +238,7 @@ public:
protected:
TableIterator() : zeek::OpaqueVal(opaque_of_table_iterator) {}
DECLARE_OPAQUE_VALUE_V2(zeek::Broker::detail::TableIterator)
DECLARE_OPAQUE_VALUE_DATA(zeek::Broker::detail::TableIterator)
};
class VectorIterator : public zeek::OpaqueVal {
@ -254,7 +254,7 @@ public:
protected:
VectorIterator() : zeek::OpaqueVal(opaque_of_vector_iterator) {}
DECLARE_OPAQUE_VALUE_V2(zeek::Broker::detail::VectorIterator)
DECLARE_OPAQUE_VALUE_DATA(zeek::Broker::detail::VectorIterator)
};
class RecordIterator : public zeek::OpaqueVal {
@ -270,7 +270,7 @@ public:
protected:
RecordIterator() : zeek::OpaqueVal(opaque_of_record_iterator) {}
DECLARE_OPAQUE_VALUE_V2(zeek::Broker::detail::RecordIterator)
DECLARE_OPAQUE_VALUE_DATA(zeek::Broker::detail::RecordIterator)
};
} // namespace zeek::Broker::detail

View file

@ -127,7 +127,7 @@ public:
protected:
IntrusivePtr<Val> DoClone(CloneState* state) override { return {NewRef{}, this}; }
DECLARE_OPAQUE_VALUE_V2(StoreHandleVal)
DECLARE_OPAQUE_VALUE_DATA(StoreHandleVal)
};
// Helper function to construct a broker backend type from script land.

View file

@ -184,7 +184,7 @@ protected:
*/
X509Val();
DECLARE_OPAQUE_VALUE_V2(X509Val)
DECLARE_OPAQUE_VALUE_DATA(X509Val)
private:
::X509* certificate; // the wrapped certificate
};

View file

@ -56,7 +56,7 @@ public:
protected:
explicit LogDelayTokenVal() : LogDelayTokenVal(0) {}
DECLARE_OPAQUE_VALUE_V2(LogDelayTokenVal)
DECLARE_OPAQUE_VALUE_DATA(LogDelayTokenVal)
private:
DelayTokenType token;

View file

@ -105,8 +105,8 @@ public:
*/
virtual std::string InternalState() const = 0;
[[deprecated("use SerializeData instead")]] broker::expected<broker::data> Serialize() const;
[[deprecated("use UnserializeData instead")]] static std::unique_ptr<BloomFilter> Unserialize(
[[deprecated("Remove in v7.1: use SerializeData instead")]] broker::expected<broker::data> Serialize() const;
[[deprecated("Remove in v7.1: use UnserializeData instead")]] static std::unique_ptr<BloomFilter> Unserialize(
const broker::data& data);
std::optional<BrokerData> SerializeData() const;
static std::unique_ptr<BloomFilter> UnserializeData(BrokerDataView data);

View file

@ -132,7 +132,7 @@ public:
*/
ValPtr DoClone(CloneState* state) override;
DECLARE_OPAQUE_VALUE_V2(TopkVal)
DECLARE_OPAQUE_VALUE_DATA(TopkVal)
protected:
/**