blockbuffer

package
v1.1.0-alpha-4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRetryExceeded = errors.New("retry exceeded")
)

Functions

This section is empty.

Types

type Buffer

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

Buffer defines buffer of tlog blocks that already sent but still waiting to be succesfully received by the server

func NewBuffer

func NewBuffer(timeout time.Duration) *Buffer

NewBuffer creates a new tlog blocks buffer

func (*Buffer) Add

func (b *Buffer) Add(block *schema.TlogBlock)

Add adds a block to this buffer. It only update the states if already exist.

func (*Buffer) Delete

func (b *Buffer) Delete(seq uint64)

Delete deletes an entry from buffer.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns number of blocks in this buffer

func (*Buffer) MinSequence

func (b *Buffer) MinSequence() uint64

MinSequence returns min sequence that this buffer will/currently has.

func (*Buffer) NeedResend

func (b *Buffer) NeedResend(seq uint64) bool

Returns true this seq need to be re-send

func (*Buffer) Promote

func (b *Buffer) Promote(seq uint64) error

Promote sets a block with given sequence to be timed out now. It returns error if the block already exceed it's retry quota.

func (*Buffer) TimedOut

func (b *Buffer) TimedOut(ctx context.Context) <-chan *schema.TlogBlock

TimedOut returns channel of timed out block

Jump to

Keyboard shortcuts

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