requests

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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:"-"`
	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 capabilities.CapabilityResponse
	StopCh     services.StopChan

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

	KeyID string
}

func (*Request) Copy

func (r *Request) Copy() *Request

type Response

type Response struct {
	WorkflowExecutionID string
	capabilities.CapabilityResponse
}

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

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