checkpoint

package
v0.1.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package checkpoint expose the Checkpointer interface, used to checkpoint, or save, the current progress of a Subscription, so that it might survive application restarts without reprocessing Events.

Index

Constants

This section is empty.

Variables

View Source
var NopCheckpointer = FixedCheckpointer{StartingFrom: 0}

NopCheckpointer is a Checkpointer implementation that always restarts from the beginning.

Functions

This section is empty.

Types

type Checkpointer

type Checkpointer interface {
	Read(ctx context.Context, key string) (int64, error)
	Write(ctx context.Context, key string, sequenceNumber int64) error
}

Checkpointer represents a component that contains the current state of progress of a named Subscription, so that the Subscription can be restored from where it left off, in case of application restart.

type CheckpointerMock

type CheckpointerMock struct {
	// ReadFn is the function called on checkpoint.Checkpointer.Read.
	ReadFn func(ctx context.Context, key string) (int64, error)
	// WriteFn is the function called on checkpoint.Checkpointer.Write.
	WriteFn func(ctx context.Context, key string, sequenceNumber int64) error
}

CheckpointerMock is a mock implementation of a checkpoint.Checkpointer.

func (CheckpointerMock) Read

func (m CheckpointerMock) Read(ctx context.Context, key string) (int64, error)

Read runs the checkpoint.CheckpointerMock.ReadFn function.

func (CheckpointerMock) Write

func (m CheckpointerMock) Write(ctx context.Context, key string, sequenceNumber int64) error

Write runs the checkpoint.CheckpointerMock.WriteFn function.

type FixedCheckpointer

type FixedCheckpointer struct{ StartingFrom int64 }

FixedCheckpointer is a Checkpointer implementation that always restarts from the specified starting point.

func (FixedCheckpointer) Read

func (FixedCheckpointer) Write

Jump to

Keyboard shortcuts

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