scheduler

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryLimit   = 5
	MaxQueueSize = 10 * 60 * 60 // 10 entries/second * 1h

)
View Source
const (
	MaxRetryTimeout = 3 * 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Headers

type Headers map[string]string

Headers is a named map type for HTTP headers attached to queue entries.

type PriorityEntry

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

queue //

type Reporter

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

reporter //

func NewReporter

func NewReporter(index int, session *Session) *Reporter

func (*Reporter) Run

func (r *Reporter) Run(ctx context.Context)

type ReporterManager

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

ReporterManager manages the lifecycle of multiple reporter goroutines

func StartReporters

func StartReporters(session *Session, ctxManager *agent.ContextManager) *ReporterManager

func (*ReporterManager) Shutdown

func (rm *ReporterManager) Shutdown(timeout time.Duration) error

Shutdown gracefully stops all reporters with a timeout

type RequestQueue

type RequestQueue struct {
	// contains filtered or unexported fields
}
var (
	Rqueue *RequestQueue
)

func (*RequestQueue) Delete

func (rq *RequestQueue) Delete(url string, data interface{}, priority int, due time.Time)

func (*RequestQueue) DeleteWithHeaders

func (rq *RequestQueue) DeleteWithHeaders(url string, data interface{}, priority int, due time.Time, headers Headers)

func (*RequestQueue) Patch

func (rq *RequestQueue) Patch(url string, data interface{}, priority int, due time.Time)

func (*RequestQueue) PatchWithHeaders

func (rq *RequestQueue) PatchWithHeaders(url string, data interface{}, priority int, due time.Time, headers Headers)

func (*RequestQueue) Post

func (rq *RequestQueue) Post(url string, data interface{}, priority int, due time.Time)

func (*RequestQueue) PostChunk added in v2.3.1

func (rq *RequestQueue) PostChunk(ctx context.Context, url string, data interface{}, priority int)

PostChunk enqueues a chunk, throttling the command while the queue is full and dropping past ctx/maxWait.

func (*RequestQueue) PostWithHeaders

func (rq *RequestQueue) PostWithHeaders(url string, data interface{}, priority int, due time.Time, headers Headers)

func (*RequestQueue) Put

func (rq *RequestQueue) Put(url string, data interface{}, priority int, due time.Time)

func (*RequestQueue) Requeue

func (rq *RequestQueue) Requeue(entry PriorityEntry) error

Requeue re-enqueues an entry under cond.L and signals waiting reporters.

type Session

type Session struct {
	BaseURL       string
	Client        *http.Client
	Authorization string
}

func InitSession

func InitSession() *Session

func (*Session) CheckSession

func (session *Session) CheckSession(ctx context.Context) bool

func (*Session) Delete

func (session *Session) Delete(url string, rawBody interface{}, timeout time.Duration) ([]byte, int, error)

func (*Session) Get

func (session *Session) Get(url string, timeout time.Duration) ([]byte, int, error)

func (*Session) MultipartRequest

func (session *Session) MultipartRequest(url string, body io.Reader, contentType string, contentLength int64, timeout time.Duration) ([]byte, int, error)

MultipartRequest issues a POST with a multipart body. Pass contentLength=-1 to force chunked transfer; pass an exact byte count to use identity TE (avoids per-write chunk header overhead). Overwrites req.ContentLength unconditionally because http.NewRequest auto-fills it for bytes/strings readers, which would defeat a caller's -1 chunked opt-in.

func (*Session) Patch

func (session *Session) Patch(url string, rawBody interface{}, timeout time.Duration) ([]byte, int, error)

func (*Session) Post

func (session *Session) Post(url string, rawBody interface{}, timeout time.Duration) ([]byte, int, error)

func (*Session) Put

func (session *Session) Put(url string, rawBody interface{}, timeout time.Duration) ([]byte, int, error)

func (*Session) Request

func (session *Session) Request(method, url string, rawBody interface{}, timeout time.Duration) ([]byte, int, error)

func (*Session) RequestWithHeaders

func (session *Session) RequestWithHeaders(method, url string, rawBody interface{}, timeout time.Duration, headers Headers) ([]byte, int, error)

Jump to

Keyboard shortcuts

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