Fengzdadi commented on code in PR #94:
URL: https://github.com/apache/datasketches-go/pull/94#discussion_r2683896407
##########
sampling/reservoir_items_sketch.go:
##########
@@ -111,3 +114,94 @@ func (s *ReservoirItemsSketch[T]) Reset() {
s.n = 0
s.data = s.data[:0]
}
+
+// Preamble constants for serialization
+const (
+ preambleIntsShort = 1 // empty sketch
+ preambleIntsLong = 3 // non-empty sketch
+ serVer = 2 // serialization version
+)
+
+// ToByteArray serializes the sketch to a byte array using the provided SerDe.
+func (s *ReservoirItemsSketch[T]) ToByteArray(serde ItemsSerDe[T]) ([]byte,
error) {
Review Comment:
Thanks @proost for pointing this out!
I've renamed `ToByteArray` to [ToSlice] to match
[NewReservoirItemsSketchFromSlice] for naming consistency.
I apologize for missing this - my programming experience is still limited
and I sometimes overlook these API design patterns. I'll pay more attention to
naming conventions in future contributions.
Thank you for the patient review!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]