state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveBoundary

type ActiveBoundary struct {
	StartBlockNumber uint64 `yaml:"start_block_number"  json:"start_block_number"`
	EndBlockNumber   uint64 `yaml:"end_block_number"  json:"end_block_number"`
}

type BlockState

type BlockState struct {
	ID     string `yaml:"id" json:"id"`
	Number uint64 `yaml:"number" json:"number"`
}

type FileState

type FileState struct {
	Cursor         string         `yaml:"cursor" json:"cursor"`
	Block          BlockState     `yaml:"block" json:"block"`
	ActiveBoundary ActiveBoundary `yaml:"active_boundary" json:"active_boundary"`

	// StartedAt is the time this process was launching initially without accounting to any restart, once set, this
	// value, it's never re-written (unless the file does not exist anymore).
	StartedAt time.Time `yaml:"started_at,omitempty" json:"started_at,omitempty"`
	// RestartedAt is the time this process was last launched meaning it's reset each time the process start. This value
	// in contrast to `StartedAt` change over time each time the process is restarted.
	RestartedAt time.Time `yaml:"restarted_at,omitempty" json:"restarted_at,omitempty"`
}

type FileStateStore

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

func NewFileStateStore

func NewFileStateStore(outputPath string) (*FileStateStore, error)

func (*FileStateStore) GetState

func (s *FileStateStore) GetState() (Saveable, error)

func (*FileStateStore) NewBoundary

func (s *FileStateStore) NewBoundary(boundary *bstream.Range)

func (*FileStateStore) ReadCursor

func (s *FileStateStore) ReadCursor() (cursor *sink.Cursor, err error)

func (*FileStateStore) SetCursor

func (s *FileStateStore) SetCursor(cursor *sink.Cursor)

type Saveable

type Saveable interface {
	Save() error
}

type Store

type Store interface {
	NewBoundary(*bstream.Range)
	ReadCursor() (*sink.Cursor, error)
	SetCursor(*sink.Cursor)
	GetState() (Saveable, error)
}

Jump to

Keyboard shortcuts

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