This modifies the entire repository to use the new formatting of doc comments in the upcoming Go 1.19 release. The primary motivating factors for this are: - Builds check that files are formatted per gofmt and that will no longer be true as of Go 1.19 without these changes - Separating all the updates into a single commit ensures these documentation only formatting changes do not clutter up diffs that actually change code For the most part, the changes are just the automated changes suggested by the Go 1.19 version of gofmt, but there are also a few cases where the comments were reworded a bit to play nicely with the new formatting requirements. For example, the new version of gofmt reformats and collapses nested lists where as the existing version does not. Thus, instances of nested lists have been changed to either eliminate them or use mixed markers which produce expect results. |
||
|---|---|---|
| .. | ||
| blockcf2 | ||
| bench_test.go | ||
| bits_test.go | ||
| bits.go | ||
| doc.go | ||
| error_test.go | ||
| error.go | ||
| fastreduce_old.go | ||
| fastreduce.go | ||
| gcs_test.go | ||
| gcs.go | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
gcs
Package gcs provides an API for building and using Golomb-coded sets.
A Golomb-Coded Set (GCS) is a space-efficient probabilistic data structure that is used to test set membership with a tunable false positive rate while simultaneously preventing false negatives. In other words, items that are in the set will always match, but items that are not in the set will also sometimes match with the chosen false positive rate.
This package currently implements two different versions for backwards compatibility. Version 1 is deprecated and therefore should no longer be used.
Version 2 is the GCS variation that follows the specification details in DCP0005.
Version 2 sets do not permit empty items (data of zero length) to be added and are parameterized by the following:
- A parameter
Bthat defines the remainder code bit size - A parameter
Mthat defines the false positive rate as1/M - A key for the SipHash-2-4 function
- The items to include in the set
A comprehensive suite of tests is provided to ensure proper functionality.
GCS use in Decred
GCS is used as a mechanism for storing, transmitting, and committing to per-block filters. Consensus-validating full nodes commit to a single filter for every block and serve the filter to SPV clients that match against the filter locally to determine if the block is potentially relevant. The required parameters for Decred are defined by the blockcf2 package.
For more details, see the Block Filters section of DCP0005.
Installation and Updating
This package is part of the github.com/decred/dcrd/gcs/v2 module. Use the
standard go tooling for working with modules to incorporate it.
License
Package blockchain is licensed under the copyfree ISC License.