stream

package
v0.0.0-...-859fa4b Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFlowTerminated = errors.New("flow terminated")
)

Functions

This section is empty.

Types

type EtcdFlow

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

func (*EtcdFlow) RegisterListHandler

func (f *EtcdFlow) RegisterListHandler(path string, h FlowEventHandler)

func (*EtcdFlow) RegisterWatchHandler

func (f *EtcdFlow) RegisterWatchHandler(path string, h FlowEventHandler)

func (*EtcdFlow) Run

func (f *EtcdFlow) Run(ctx context.Context)

type Flow

type Flow interface {
	RegisterWatchHandler(path string, handler FlowEventHandler)
	RegisterListHandler(path string, handler FlowEventHandler)
	Run(ctx context.Context)
}

func NewEtcdFlow

func NewEtcdFlow(cli *clientv3.Client, opts ...FlowOption) Flow

type FlowEvent

type FlowEvent struct {
	Type   FlowEventType
	Kv     *FlowKeyValue
	PrevKv *FlowKeyValue
}

func (*FlowEvent) IsCreated

func (e *FlowEvent) IsCreated() bool

func (*FlowEvent) IsDeleted

func (e *FlowEvent) IsDeleted() bool

func (*FlowEvent) IsUpdated

func (e *FlowEvent) IsUpdated() bool

type FlowEventHandler

type FlowEventHandler func(event *FlowEvent) error

type FlowEventType

type FlowEventType string
const (
	FlowEventCreated FlowEventType = "CREATED"
	FlowEventUpdated FlowEventType = "UPDATED"
	FlowEventDeleted FlowEventType = "DELETED"
)

type FlowKeyValue

type FlowKeyValue struct {
	Key            string
	CreateRevision int64
	ModRevision    int64
	Version        int64
	Value          string
}

type FlowOption

type FlowOption func(config *flowConfig)

func WithPageSize

func WithPageSize(size int) FlowOption

func WithWatchBufferSize

func WithWatchBufferSize(size int) FlowOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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