You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.1 KiB

  1. package peer
  2. import (
  3. . "github.com/tendermint/tendermint/binary"
  4. "io"
  5. )
  6. /* Set
  7. A Set could be a bloom filter for lossy filtering, or could be a lossless filter.
  8. */
  9. type Set interface {
  10. Binary
  11. Add(Msg)
  12. Has(Msg) bool
  13. // Loads a new set.
  14. // Convenience factory method
  15. Load(ByteSlice) Set
  16. }
  17. /* BloomFilterSet */
  18. type BloomFilterSet struct {
  19. lastBlockHeight UInt64
  20. lastHeaderHeight UInt64
  21. }
  22. func (bs *BloomFilterSet) WriteTo(w io.Writer) (n int64, err error) {
  23. n, err = WriteOnto(String("block"), w, n, err)
  24. n, err = WriteOnto(bs.lastBlockHeight, w, n, err)
  25. n, err = WriteOnto(bs.lastHeaderHeight, w, n, err)
  26. return
  27. }
  28. func (bs *BloomFilterSet) Add(msg Msg) {
  29. }
  30. func (bs *BloomFilterSet) Has(msg Msg) bool {
  31. return false
  32. }
  33. func (bs *BloomFilterSet) Load(bytes ByteSlice) Set {
  34. return nil
  35. }
  36. /* BitarraySet */
  37. type BlockSet struct {
  38. }
  39. func (bs *BlockSet) WriteTo(w io.Writer) (n int64, err error) {
  40. return
  41. }
  42. func (bs *BlockSet) Add(msg Msg) {
  43. }
  44. func (bs *BlockSet) Has(msg Msg) bool {
  45. return false
  46. }
  47. func (bs *BlockSet) Load(bytes ByteSlice) Set {
  48. return nil
  49. }