internal

package
v7.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package internal provides internal structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPermanentError

func IsPermanentError(err error) bool

IsPermanentError returns true if the error is non-retriable.

Types

type FileLock

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

FileLock provides a file lock mechanism based on flock.

func NewFileLock

func NewFileLock(path string, verbose bool) (*FileLock, error)

NewFileLock creates a new instance of FileLock.

func (*FileLock) Acquire

func (f *FileLock) Acquire() error

Acquire tries to acquire a file lock. It is possible for multiple goroutines within the same process to acquire the same lock, so acquireLock is not thread safe in that sense, but protects access across different processes.

func (*FileLock) Release

func (f *FileLock) Release() error

Release unlocks the file lock.

type HTTPError

type HTTPError struct {
	Body       string
	StatusCode int
}

HTTPError is an error from performing an HTTP request.

func (HTTPError) Error

func (h HTTPError) Error() string

type JobProcessor

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

JobProcessor runs jobs with a set number of workers.

func NewJobProcessor

func NewJobProcessor(ctx context.Context, workers int) *JobProcessor

NewJobProcessor inits a new JobProcessor struct.

func (*JobProcessor) Add

func (j *JobProcessor) Add(job func(context.Context) error)

Add queues a job for processing.

func (*JobProcessor) Run

func (j *JobProcessor) Run(ctx context.Context) error

Run processes the job queue and returns the first error encountered, if any.

func (*JobProcessor) Stop

func (j *JobProcessor) Stop()

Stop cancels all queued jobs.

func (*JobProcessor) Wait

func (j *JobProcessor) Wait() error

Wait waits for all jobs to finish processing and returns the first error encountered, if any.

Directories

Path Synopsis
Package geoipupdate provides a library for using MaxMind's GeoIP Update service.
Package geoipupdate provides a library for using MaxMind's GeoIP Update service.
database
Package database writes MMDBs to disk.
Package database writes MMDBs to disk.
Package vars holds random vars, consts, and defaults.
Package vars holds random vars, consts, and defaults.

Jump to

Keyboard shortcuts

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