client

package
v0.0.0-...-64b8ef3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	InputCh       <-chan *InputArg
	LastCommitSeq uint64
	Logger        Logger
}

type InputArg

type InputArg struct {
	Data   []byte
	Offset int64
}

InputArg holds kafka message data and offset.User send InputArg to the decoder, and the decoder will decode kafka message and return OutputResult to user.

type Logger

type Logger interface {
	Printf(string, ...interface{})
}

Logger is an interface that can be implemented to provide custom log output.

var DefaultLogger Logger = defaultLogger{}

DefaultLogger uses the stdlib log package for logging.

type OperationDecoder

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

func NewOperationDecoder

func NewOperationDecoder(cfg *Config) (*OperationDecoder, error)

NewOperationDecoder need to know last CommitSeq of last OutputResult user has handled/consumed, it can be 0 if user first time create decoder, or user didn't save CommitSeq.

func (*OperationDecoder) Close

func (o *OperationDecoder) Close() error

func (*OperationDecoder) Err

func (o *OperationDecoder) Err() <-chan error

func (*OperationDecoder) Output

func (o *OperationDecoder) Output() <-chan *OutputResult

type OutputResult

type OutputResult struct {
	Ops          []*protocol.Operation
	BeginSeq     uint64
	EndSeq       uint64
	BeginOffset  int64
	EndOffset    int64
	CommitOffset int64
	CommitSeq    uint64
}

OutputResult holds operations decoded from kafka message, seq info, offset info and commit info. Once user has handled/consumed this OutputResult, user can save/commit the commit info. After user restart, user can continue consume kafka from offset at CommitOffset+1.

Jump to

Keyboard shortcuts

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