dstee

package
v0.2.4-0...-f8342f3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchItem

type BatchItem struct {
	Key   ds.Key
	Value []byte
}

type CSVTee

type CSVTee struct {
	Name string
	CSV  *csv.Writer
	Log  logrus.FieldLogger
	sync.Mutex
}

func (*CSVTee) OnBatch

func (t *CSVTee) OnBatch(puts []BatchItem, deletes []ds.Key)

func (*CSVTee) OnDelete

func (t *CSVTee) OnDelete(key ds.Key)

func (*CSVTee) OnPut

func (t *CSVTee) OnPut(key ds.Key, value []byte)

func (*CSVTee) String

func (t *CSVTee) String() string

type DSTee

type DSTee struct {
	ds.Batching
	Tee Tee
}

func (*DSTee) Batch

func (t *DSTee) Batch() (ds.Batch, error)

func (*DSTee) Delete

func (t *DSTee) Delete(key ds.Key) error

func (*DSTee) Put

func (t *DSTee) Put(key ds.Key, value []byte) error

type DSTeeBatch

type DSTeeBatch struct {
	Batch ds.Batch
	Tee   Tee
	// contains filtered or unexported fields
}

func (*DSTeeBatch) Commit

func (b *DSTeeBatch) Commit() error

func (*DSTeeBatch) Delete

func (b *DSTeeBatch) Delete(key ds.Key) error

func (*DSTeeBatch) Put

func (b *DSTeeBatch) Put(key ds.Key, value []byte) error

func (*DSTeeBatch) Reset

func (b *DSTeeBatch) Reset()

type Event

type Event struct {
	Op      Operation                        `json:"op"`
	PeerID  peer.ID                          `json:"peer_id"`
	TimeMs  uint64                           `json:"time_ms"`
	DelPath string                           `json:"del_path,omitempty"`
	Entry   *translate.PartialPeerstoreEntry `json:"change,omitempty"`
}

type EventTee

type EventTee struct {
	Fn func(evs ...*Event)
}

EventTee transforms raw puts/deletes into events, and forwards them to a function. The EventTee wraps the function, to be a hashable type for use in multi-tees.

func (*EventTee) OnBatch

func (t *EventTee) OnBatch(puts []BatchItem, deletes []ds.Key)

func (*EventTee) OnDelete

func (t *EventTee) OnDelete(key ds.Key)

func (*EventTee) OnPut

func (t *EventTee) OnPut(key ds.Key, value []byte)

func (*EventTee) String

func (t *EventTee) String() string

type FilterTee

type FilterTee struct {
	Inner   Tee
	Pattern *regexp.Regexp
}

func (*FilterTee) OnBatch

func (t *FilterTee) OnBatch(puts []BatchItem, deletes []ds.Key)

func (*FilterTee) OnDelete

func (t *FilterTee) OnDelete(key ds.Key)

func (*FilterTee) OnPut

func (t *FilterTee) OnPut(key ds.Key, value []byte)

func (*FilterTee) String

func (t *FilterTee) String() string

type LogTee

type LogTee struct {
	Log logrus.FieldLogger
}

func (*LogTee) OnBatch

func (t *LogTee) OnBatch(puts []BatchItem, deletes []ds.Key)

func (*LogTee) OnDelete

func (t *LogTee) OnDelete(key ds.Key)

func (*LogTee) OnPut

func (t *LogTee) OnPut(key ds.Key, value []byte)

func (*LogTee) String

func (t *LogTee) String() string

type MultiTee

type MultiTee map[Tee]struct{}

func (MultiTee) OnBatch

func (m MultiTee) OnBatch(puts []BatchItem, deletes []ds.Key)

func (MultiTee) OnDelete

func (m MultiTee) OnDelete(key ds.Key)

func (MultiTee) OnPut

func (m MultiTee) OnPut(key ds.Key, value []byte)

func (MultiTee) String

func (m MultiTee) String() string

type Operation

type Operation string
const (
	Put    Operation = "put"
	Delete Operation = "del"
)

type Tee

type Tee interface {
	String() string
	OnPut(key ds.Key, value []byte)
	OnDelete(key ds.Key)
	OnBatch(puts []BatchItem, deletes []ds.Key)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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