cpaccessor

package
v0.0.0-...-70fd0a4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package cpaccessor contains methods to access streams with checkpointing conception.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckpointingAccessor

type CheckpointingAccessor[T any] struct {
	// contains filtered or unexported fields
}

CheckpointingAccessor is used to access stream with checkpoints.

func NewCheckpointingAccessor

func NewCheckpointingAccessor[T any]() CheckpointingAccessor[T]

func (*CheckpointingAccessor[T]) Commit

func (a *CheckpointingAccessor[T]) Commit()

Commit marks the latest checkpoint as successful and removes it. Further Rollback calls will not return accessor to this checkpoint.

func (*CheckpointingAccessor[T]) Next

func (a *CheckpointingAccessor[T]) Next() T

Next moves accessor to the next element in the stream.

func (*CheckpointingAccessor[T]) Reset

func (a *CheckpointingAccessor[T]) Reset()

func (*CheckpointingAccessor[T]) Rollback

func (a *CheckpointingAccessor[T]) Rollback() T

Rollback moves accessor to the latest uncommited checkpoint and removes checkpoint. Returned value - is the last element before checkpoint set.

func (*CheckpointingAccessor[T]) SetCheckpoint

func (a *CheckpointingAccessor[T]) SetCheckpoint()

SetCheckpoint sets checkpoint at current position in the stream.

func (*CheckpointingAccessor[T]) SetStream

func (a *CheckpointingAccessor[T]) SetStream(stream ResourceStream[T])

type ResourceStream

type ResourceStream[T any] interface {
	Next() T
}

ResourceStream represents an underlying stream for accessing elements.

Jump to

Keyboard shortcuts

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