aws

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package aws contains an AWS-based antispam implementation for Tessera.

A MySQL database provides a mechanism for maintaining an index of hash --> log position for detecting duplicate submissions.

Index

Constants

View Source
const (
	DefaultMaxBatchSize      = 64
	DefaultPushbackThreshold = 2048

	// SchemaCompatibilityVersion represents the expected version (e.g. layout & serialisation) of stored data.
	//
	// A binary built with a given version of the Tessera library is compatible with stored data created by a different version
	// of the library if and only if this value is the same as the compatibilityVersion stored in the Tessera table.
	//
	// NOTE: if changing this version, you need to consider whether end-users are going to update their schema instances to be
	// compatible with the new format, and provide a means to do it if so.
	SchemaCompatibilityVersion = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AntispamOpts

type AntispamOpts struct {
	// MaxBatchSize is the largest number of mutations permitted in a single write operation when
	// updating the antispam index.
	//
	// Larger batches can enable (up to a point) higher throughput, but care should be taken not to
	// overload the database instance.
	MaxBatchSize uint

	// PushbackThreshold allows configuration of when to start responding to Add requests with pushback due to
	// the antispam follower falling too far behind.
	//
	// When the antispam follower is at least this many entries behind the size of the locally integrated tree,
	// the antispam decorator will return a wrapped tessera.ErrPushback for every Add request.
	PushbackThreshold uint

	PushbackMaxOutstanding uint64
	MaxOpenConns           int
	MaxIdleConns           int
}

AntispamOpts allows configuration of some tunable options.

type AntispamStorage

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

func NewAntispam

func NewAntispam(ctx context.Context, dsn string, opts AntispamOpts) (*AntispamStorage, error)

NewAntispam returns an antispam driver which uses a MySQL table to maintain a mapping of previously seen entries and their assigned indices.

Note that the storage for this mapping is entirely separate and unconnected to the storage used for maintaining the Merkle tree.

This functionality is experimental!

func (*AntispamStorage) Decorator

func (d *AntispamStorage) Decorator() func(f tessera.AddFn) tessera.AddFn

Decorator returns a function which will wrap an underlying Add delegate with code to dedup against the stored data.

func (*AntispamStorage) Follower

func (d *AntispamStorage) Follower(b func([]byte) ([][]byte, error)) stream.Follower

Follower returns a follower which knows how to populate the antispam index.

This implements tessera.Antispam.

Jump to

Keyboard shortcuts

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