dedup

package
v0.34.0-beta.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author added in v0.35.0

type Author struct {
	PublicKey statusproto.HexBytes `json:"publicKey"`
	Alias     string               `json:"alias"`
	Identicon string               `json:"identicon"`
}

type DeduplicateMessage added in v0.35.0

type DeduplicateMessage struct {
	Message       *whispertypes.Message `json:"message"`
	Metadata      Metadata              `json:"metadata"`
	Payload       string                `json:"payload"`
	MessageType   v1.StatusMessageT     `json:"messageType"`
	ParsedMessage interface{}           `json:"parsedMessage"`
}

type Deduplicator

type Deduplicator struct {
	// contains filtered or unexported fields
}

Deduplicator filters out already received messages for a current filter. It keeps a limited cache of the messages.

func NewDeduplicator

func NewDeduplicator(keyPairProvider keyPairProvider, db *leveldb.DB) *Deduplicator

NewDeduplicator creates a new deduplicator

func (*Deduplicator) AddMessageByID added in v0.35.0

func (d *Deduplicator) AddMessageByID(messageIDs [][]byte) error

AddMessageByID adds a message to the deduplicator DB, so it will be filtered out.

func (*Deduplicator) AddMessagesByID added in v0.35.0

func (d *Deduplicator) AddMessagesByID(messageIDs [][]byte) error

AddMessages adds a message to the deduplicator DB, so it will be filtered out.

func (*Deduplicator) Deduplicate

func (d *Deduplicator) Deduplicate(messages []*DeduplicateMessage) []*DeduplicateMessage

Deduplicate receives a list of whisper messages and returns the list of the messages that weren't filtered previously for the specified filter.

type Metadata added in v0.35.0

type Metadata struct {
	DedupID      []byte               `json:"dedupId"`
	EncryptionID statusproto.HexBytes `json:"encryptionId"`
	MessageID    statusproto.HexBytes `json:"messageId"`
	Author       Author               `json:"author"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL