proost commented on code in PR #94:
URL: https://github.com/apache/datasketches-go/pull/94#discussion_r2682486695
##########
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:
Consistent names are good. `ToByteArray` with
`NewReservoirItemsSketchFromByteArray` or `ToSlice` with
`NewReservoirItemsSketchFromSlice`
--
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]