Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcs: Standardize serialization on a single format. #1851

Merged
merged 1 commit into from
Aug 22, 2019

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Aug 21, 2019

Currently, the filters provide two different serialization formats per version. The first is the raw filter bytes without the number of items in its data set and is implemented by the Bytes and FromBytesV1 functions. The second includes that information and is implemented by the NBytes and FromNBytesV1 functions.

In practice, the ability to serialize the filter independently from the number of items in its data set is not very useful since that information is required to be able to query the filter and, unlike the other parameters which are fixed (e.g. false positive rate and key), the number of items varies per filter. For this reason, all usage in practice calls NBytes and FromNBytesV1.

Consequently, this simplifies the API for working with filters by standardizing on a single serialization format per filter version which includes the number of items in its data set.

In order to accomplish this, the current Bytes and FromBytesV1 functions are removed and the NBytes and FromNBytesV1 functions are renamed to take their place.

This also updates all tests and callers in the repo accordingly.

@davecgh davecgh added this to the 1.5.0 milestone Aug 21, 2019
@davecgh davecgh force-pushed the gcs_single_serialization_format branch from a9d3f34 to 2909ae5 Compare August 21, 2019 04:57
@davecgh davecgh mentioned this pull request Aug 21, 2019
@davecgh davecgh force-pushed the gcs_single_serialization_format branch from 2909ae5 to a4babe6 Compare August 21, 2019 09:23
Currently, the filters provide two different serialization formats per
version.  The first is the raw filter bytes without the number of items
in its data set and is implemented by the Bytes and FromBytesV1
functions.  The second includes that information and is implemented by
the NBytes and FromNBytesV1 functions.

In practice, the ability to serialize the filter independently from the
number of items in its data set is not very useful since that
information is required to be able to query the filter and, unlike the
other parameters which are fixed (e.g. false positive rate and key), the
number of items varies per filter.  For this reason, all usage in
practice calls NBytes and FromNBytesV1.

Consequently, this simplifies the API for working with filters by
standardizing on a single serialization format per filter version which
includes the number of items in its data set.

In order to accomplish this, the current Bytes and FromBytesV1 functions
are removed and the NBytes and FromNBytesV1 functions are renamed to
take their place.

This also updates all tests and callers in the repo accordingly.
@davecgh davecgh force-pushed the gcs_single_serialization_format branch from a4babe6 to 665ab37 Compare August 22, 2019 14:50
@davecgh davecgh merged commit 665ab37 into decred:master Aug 22, 2019
@davecgh davecgh deleted the gcs_single_serialization_format branch August 22, 2019 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants