events

package
v0.0.0-...-45ae864 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvtKindRepoChange = "repoChange"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {

	// Repo is the DID of the repo this event is about
	Repo string

	Seq  int64
	Kind string

	RepoOps    []*RepoOp
	RepoRebase bool
	CarSlice   []byte

	// some private fields for internal routing perf
	PrivUid         uint   `json:"-"`
	PrivPdsId       uint   `json:"-"`
	PrivRelevantPds []uint `json:"-"`
}

type EventManager

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

func NewEventManager

func NewEventManager() *EventManager

func (*EventManager) AddEvent

func (em *EventManager) AddEvent(ev *Event) error

func (*EventManager) Run

func (em *EventManager) Run()

func (*EventManager) Subscribe

func (em *EventManager) Subscribe(filter func(*Event) bool, since *int64) (<-chan *Event, func(), error)

type EventPersistence

type EventPersistence interface {
	Persist(e *Event)
	Playback(since int64, cb func(*Event) error) error
}

type MemPersister

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

MemPersister is the most naive implementation of event persistence ill do better later

func NewMemPersister

func NewMemPersister() *MemPersister

func (*MemPersister) Persist

func (mp *MemPersister) Persist(e *Event)

func (*MemPersister) Playback

func (mp *MemPersister) Playback(since int64, cb func(*Event) error) error

type Operation

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

type RepoOp

type RepoOp struct {
	Kind       string
	Collection string
	Rkey       string

	PrivRelevantPds []uint `json:"-"`
}

type Subscriber

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

Jump to

Keyboard shortcuts

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