decoder

package
v1.1.0-alpha-7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 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()

Close releases all of it's acquired resources.

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
}

LimitBySequence implement Limiter interface which is limited by start and end sequence

func NewLimitBySequence

func NewLimitBySequence(startSeq, endSeq uint64) LimitBySequence

NewLimitBySequence creates new LimitBySequence object

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 {

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

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

	// StartBlock returns true if it is the start of block we want to decode
	StartBlock(schema.TlogBlock) bool

	// EndBlock returns true if it is the end of block we want to decode
	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