blockbuffer

package
v1.1.0-alpha-8 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 6 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 for: - to be succesfully received by the server - to be flushed

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) LastFlushed

func (b *Buffer) LastFlushed() uint64

LastFlushed returns last sequence flushed

func (*Buffer) NeedResend

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

NeedResend returns true if this sequence need to be re-send

func (*Buffer) SetFlushed

func (b *Buffer) SetFlushed(seqs []uint64)

SetFlushed set this sequence as succesfully flushed

func (*Buffer) SetResendAll

func (b *Buffer) SetResendAll()

SetResendAll resets this buffer, make all blocks need to be resend right now

func (*Buffer) SetSent

func (b *Buffer) SetSent(seq uint64)

SetSent set this sequence as succesfully sent

func (*Buffer) TimedOut

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

TimedOut returns channel of timed out block

type Uint64Slice

type Uint64Slice []uint64

Uint64Slice implements sort interface for buffer.seqToTimeout

func (Uint64Slice) Len

func (us Uint64Slice) Len() int

func (Uint64Slice) Less

func (us Uint64Slice) Less(i, j int) bool

func (Uint64Slice) Swap

func (us Uint64Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

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