bamboo

package module
v0.0.0-...-70a76fe Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 18 Imported by: 1

README

bamboo-root

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ResponseType_name = map[int32]string{
		0: "HEARTBEAT",
		1: "DATA",
	}
	ResponseType_value = map[string]int32{
		"HEARTBEAT": 0,
		"DATA":      1,
	}
)

Enum value maps for ResponseType.

View Source
var ErrAborted = errors.New("Aborted")
View Source
var ErrTimedout = errors.New("Timedout")
View Source
var File_bamboo_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type BambooRequestProducer

type BambooRequestProducer interface {
	Produce(ctx context.Context, resultChannel string, heartbeatIntervalSec int, jobTimeoutSec int, headers map[string]string, data []byte) error
	Close(ctx context.Context) error
}

func NewKafkaBambooRequestProducer

func NewKafkaBambooRequestProducer(ctx context.Context, workerName string, kafkaWriter *kafka.Writer, propagator propagation.TextMapPropagator) BambooRequestProducer

func NewRedisBambooRequestProducer

func NewRedisBambooRequestProducer(ctx context.Context, workerName string, producerOptions redis.UniversalOptions, producerChannel string, propagator propagation.TextMapPropagator) BambooRequestProducer

type BambooResultSubscriber

type BambooResultSubscriber interface {
	Ping(ctx context.Context) error
	Subscribe(ctx context.Context, resultChannel string, heartbeatIntervalSec int, jobTimeoutSec int) ([]byte, error)
}

func NewRedisResultSubscriber

func NewRedisResultSubscriber(ctx context.Context, workerName string, subscriberConfig *redis.UniversalOptions) BambooResultSubscriber

type BambooWorker

type BambooWorker interface {
	Run(ctx context.Context) error
}

func NewKafkaRedisBambooWorker

func NewKafkaRedisBambooWorker(consumerOptions kafka.ReaderConfig, publisherOptions *redis.UniversalOptions, workerFunc WorkerFunc, numWorkers int, logConfigFunc LogConfigFunc) BambooWorker

func NewRedisRedisBambooWorker

func NewRedisRedisBambooWorker(consumerOptions *redis.UniversalOptions, consumerChannel string, publisherOptions *redis.UniversalOptions, workerFunc WorkerFunc, numWorkers int, logConfigFunc LogConfigFunc) BambooWorker

type ByteArreayResult

type ByteArreayResult struct {
	Value []byte
	Error error
}

type LogConfigFunc

type LogConfigFunc func(ctx context.Context, headers map[string]string) context.Context

type RedisBambooHeartbeatPublisher

type RedisBambooHeartbeatPublisher interface {
	Run(ctx context.Context)
}

func NewRedisBambooHeartbeatPublisher

func NewRedisBambooHeartbeatPublisher(publisherOptions *redis.UniversalOptions, resultChannel string, heartbeatIntervalSec int, done <-chan interface{}, aborted <-chan interface{}) RedisBambooHeartbeatPublisher

type RedisJob

type RedisJob interface {
	Run(ctx context.Context) error
}

func NewRedisJob

func NewRedisJob(ctx context.Context, carrier propagation.MapCarrier, workerFunc WorkerFunc, headers map[string]string, parameter []byte, publisherOptions *redis.UniversalOptions, resultChannel string, done chan<- interface{}, aborted <-chan interface{}, logConfigFunc LogConfigFunc) RedisJob

type RedisResultSubscriber

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

func (*RedisResultSubscriber) Ping

func (*RedisResultSubscriber) Subscribe

func (s *RedisResultSubscriber) Subscribe(ctx context.Context, resultChannel string, heartbeatIntervalSec int, jobTimeoutSec int) ([]byte, error)

type ResponseType

type ResponseType int32
const (
	ResponseType_HEARTBEAT ResponseType = 0
	ResponseType_DATA      ResponseType = 1
)

func (ResponseType) Descriptor

func (ResponseType) Enum

func (x ResponseType) Enum() *ResponseType

func (ResponseType) EnumDescriptor deprecated

func (ResponseType) EnumDescriptor() ([]byte, []int)

Deprecated: Use ResponseType.Descriptor instead.

func (ResponseType) Number

func (ResponseType) String

func (x ResponseType) String() string

func (ResponseType) Type

type WorkerFunc

type WorkerFunc func(ctx context.Context, headers map[string]string, data []byte, aborted <-chan interface{}) ([]byte, error)

type WorkerParameter

type WorkerParameter struct {
	Carrier              map[string]string `` /* 155-byte string literal not displayed */
	Headers              map[string]string `` /* 155-byte string literal not displayed */
	ResultChannel        string            `protobuf:"bytes,3,opt,name=resultChannel,proto3" json:"resultChannel,omitempty"`
	HeartbeatIntervalSec int32             `protobuf:"varint,4,opt,name=heartbeatIntervalSec,proto3" json:"heartbeatIntervalSec,omitempty"`
	JobTimeoutSec        int32             `protobuf:"varint,5,opt,name=jobTimeoutSec,proto3" json:"jobTimeoutSec,omitempty"`
	Data                 []byte            `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*WorkerParameter) Descriptor deprecated

func (*WorkerParameter) Descriptor() ([]byte, []int)

Deprecated: Use WorkerParameter.ProtoReflect.Descriptor instead.

func (*WorkerParameter) GetCarrier

func (x *WorkerParameter) GetCarrier() map[string]string

func (*WorkerParameter) GetData

func (x *WorkerParameter) GetData() []byte

func (*WorkerParameter) GetHeaders

func (x *WorkerParameter) GetHeaders() map[string]string

func (*WorkerParameter) GetHeartbeatIntervalSec

func (x *WorkerParameter) GetHeartbeatIntervalSec() int32

func (*WorkerParameter) GetJobTimeoutSec

func (x *WorkerParameter) GetJobTimeoutSec() int32

func (*WorkerParameter) GetResultChannel

func (x *WorkerParameter) GetResultChannel() string

func (*WorkerParameter) ProtoMessage

func (*WorkerParameter) ProtoMessage()

func (*WorkerParameter) ProtoReflect

func (x *WorkerParameter) ProtoReflect() protoreflect.Message

func (*WorkerParameter) Reset

func (x *WorkerParameter) Reset()

func (*WorkerParameter) String

func (x *WorkerParameter) String() string

type WorkerResponse

type WorkerResponse struct {
	Type ResponseType `protobuf:"varint,1,opt,name=type,proto3,enum=bamboo.ResponseType" json:"type,omitempty"`
	Data []byte       `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*WorkerResponse) Descriptor deprecated

func (*WorkerResponse) Descriptor() ([]byte, []int)

Deprecated: Use WorkerResponse.ProtoReflect.Descriptor instead.

func (*WorkerResponse) GetData

func (x *WorkerResponse) GetData() []byte

func (*WorkerResponse) GetType

func (x *WorkerResponse) GetType() ResponseType

func (*WorkerResponse) ProtoMessage

func (*WorkerResponse) ProtoMessage()

func (*WorkerResponse) ProtoReflect

func (x *WorkerResponse) ProtoReflect() protoreflect.Message

func (*WorkerResponse) Reset

func (x *WorkerResponse) Reset()

func (*WorkerResponse) String

func (x *WorkerResponse) String() string

Directories

Path Synopsis
example
calc-app Module

Jump to

Keyboard shortcuts

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