requests

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	services.StateMachine
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(lggr logger.Logger, s *Store, clock clockwork.Clock, responseExpiryTime time.Duration) *Handler

func (*Handler) Close

func (h *Handler) Close() error

func (*Handler) SendRequest

func (h *Handler) SendRequest(ctx context.Context, r *Request)

func (*Handler) SendResponse

func (h *Handler) SendResponse(ctx context.Context, resp Response)

func (*Handler) Start

func (h *Handler) Start(_ context.Context) error

type Request

type Request struct {
	Observations            *values.List `mapstructure:"-"`
	OverriddenEncoderName   string
	OverriddenEncoderConfig *values.Map
	ExpiresAt               time.Time

	// CallbackCh is a channel to send a response back to the requester
	// after the request has been processed or timed out.
	CallbackCh chan Response
	StopCh     services.StopChan

	WorkflowExecutionID      string
	WorkflowID               string
	WorkflowOwner            string
	WorkflowName             string
	WorkflowDonID            uint32
	WorkflowDonConfigVersion uint32
	ReportID                 string

	KeyID string
}

func (*Request) Copy added in v0.2.2

func (r *Request) Copy() *Request

type Response

type Response struct {
	WorkflowExecutionID string
	Value               *values.Map
	Err                 error
}

type Store

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

Store stores ongoing consensus requests in an in-memory map. Note: this object is intended to be thread-safe, so any read requests should first deep-copy the returned request object via request.Copy().

func NewStore

func NewStore() *Store

func (*Store) Add

func (s *Store) Add(req *Request) error

func (*Store) FirstN

func (s *Store) FirstN(batchSize int) ([]*Request, error)

FirstN returns up to `bathSize` requests. The method deep-copies requests before returning them.

func (*Store) Get

func (s *Store) Get(requestID string) *Request

Get returns the request corresponding to request ID. The method deep-copies requests before returning them.

func (*Store) GetByIDs added in v0.2.2

func (s *Store) GetByIDs(requestIDs []string) []*Request

GetByIDs is best-effort, doesn't return requests that are not in store The method deep-copies requests before returning them.

Jump to

Keyboard shortcuts

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