decoder

package
v1.1.0-alpha-5 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilLastHash indicates that there is no last hash entry
	ErrNilLastHash = errors.New("nil last hash")
)

Functions

func GetLashHashKey

func GetLashHashKey(vdiskID string) []byte

GetLashHashKey returns last hash key of a given vdisk ID

Types

type DecodedAggregation

type DecodedAggregation struct {
	Agg *schema.TlogAggregation
	Err error
}

DecodedAggregation defines a decoded tlog aggregation from decoder.

type Decoder

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

Decoder defines tlog data decoder

func New

func New(pool tlog.RedisPool, k, m int, vdiskID, privKey, hexNonce string) (*Decoder, error)

New creates a tlog decoder

func (*Decoder) Close

func (d *Decoder) Close()

func (*Decoder) Decode

func (d *Decoder) Decode(lmt Limiter) <-chan *DecodedAggregation

Decode decodes all tlog transaction started from startTs timestamp to endTs timestamp. If startTs == 0, it means from the beginning of transaction. If endTs == 0, it means until the end of transaction

func (*Decoder) GetLastHash

func (d *Decoder) GetLastHash() ([]byte, error)

GetLastHash returns valid last hash of a vdisk. It checks all data shards to get latest valid hash

type LimitBySequence

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

func NewLimitBySequence

func NewLimitBySequence(startSeq, endSeq uint64) LimitBySequence

func (LimitBySequence) EndAgg

EndAgg implements Limiter.EndAgg

func (LimitBySequence) EndBlock

func (lbt LimitBySequence) EndBlock(block schema.TlogBlock) bool

EndBlock implementes Limiter.EndBlock

func (LimitBySequence) StartAgg

func (lbt LimitBySequence) StartAgg(agg *schema.TlogAggregation, blocks schema.TlogBlock_List) bool

StartAgg implements Limiter.StartAgg

func (LimitBySequence) StartBlock

func (lbt LimitBySequence) StartBlock(block schema.TlogBlock) bool

StartBlock implements Limiter.StartBlock

type LimitByTimestamp

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

LimitByTimestamp implements limiter based on the timestamp

func NewLimitByTimestamp

func NewLimitByTimestamp(startTs, endTs uint64) LimitByTimestamp

NewLimitByTimestamp creates new LimitByTimestamp limiter

func (LimitByTimestamp) EndAgg

EndAgg implements Limiter.EndAgg

func (LimitByTimestamp) EndBlock

func (lbt LimitByTimestamp) EndBlock(block schema.TlogBlock) bool

EndBlock implementes Limiter.EndBlock

func (LimitByTimestamp) StartAgg

func (lbt LimitByTimestamp) StartAgg(agg *schema.TlogAggregation, blocks schema.TlogBlock_List) bool

StartAgg implements Limiter.StartAgg

func (LimitByTimestamp) StartBlock

func (lbt LimitByTimestamp) StartBlock(block schema.TlogBlock) bool

StartBlock implements Limiter.StartBlock

type Limiter

type Limiter interface {
	// EndAgg returns true if it is the end  of the
	// aggregation we want to decode
	EndAgg(*schema.TlogAggregation, schema.TlogBlock_List) bool

	// StartAgg returns true if it is the start of the
	// aggregation we want to decode
	StartAgg(*schema.TlogAggregation, schema.TlogBlock_List) bool

	StartBlock(schema.TlogBlock) bool
	EndBlock(schema.TlogBlock) bool
}

Limiter is interface that needs to be implemented in order for the decoder to know which aggregations it needs to decode

Jump to

Keyboard shortcuts

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