harvest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VerbListRecords     = "ListRecords"
	VerbListIdentifiers = "ListIdentifiers"
	DateFormat          = "2006-01-02T15:04:05Z"
	UnixStart           = "1970-01-01T12:00:00Z"
)

Variables

View Source
var ErrNoRecordsMatch = errors.New("no records match OAI-PMH request")

Functions

This section is empty.

Types

type HarvestCallback

type HarvestCallback func(r *oai.Response) error

type HarvestInfo

type HarvestInfo struct {
	LastCheck    time.Time
	LastModified time.Time
	Error        string
}

type HarvestMetrics

type HarvestMetrics struct {
	Errors           []error
	Processed        int
	Deleted          int
	From             string
	Until            string
	Aborted          bool
	NoRecordsMatch   bool
	Pages            int
	CompleteListSize int
}

type HarvestTask

type HarvestTask struct {
	OrgID       string
	Name        string
	CheckEvery  time.Duration
	HarvestInfo *HarvestInfo
	Request     oai.Request
	CallbackFn  HarvestCallback

	Client *http.Client
	// contains filtered or unexported fields
}

func (*HarvestTask) BuildRequest

func (ht *HarvestTask) BuildRequest() *oai.Request

func (*HarvestTask) GetLastCheck

func (ht *HarvestTask) GetLastCheck() time.Time

GetLastCheck returns last time the task has run.

func (*HarvestTask) GetPage

func (ht *HarvestTask) GetPage(ctx context.Context, request *oai.Request) (*oai.Response, error)

func (*HarvestTask) Harvest

func (ht *HarvestTask) Harvest(ctx context.Context) error

func (*HarvestTask) SetLastCheck

func (ht *HarvestTask) SetLastCheck(t time.Time)

SetLastCheck sets time the task has run.

func (*HarvestTask) SetRelativeFrom

func (ht *HarvestTask) SetRelativeFrom()

SetRelativeFrom sets the From param based on the last check minus the duration check.

func (*HarvestTask) SetUnixStartFrom

func (ht *HarvestTask) SetUnixStartFrom()

SetUnixStartFrom sets the From param to unix start datetime.

type Option

type Option func(*Service) error

func SetDelay

func SetDelay(delay int) Option

type Service

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

func NewService

func NewService(options ...Option) (*Service, error)

func (*Service) AddTask

func (s *Service) AddTask(task ...*HarvestTask) error

func (*Service) HarvestNow

func (s *Service) HarvestNow(w http.ResponseWriter, r *http.Request)

HarvestNow starts all harvest task from the beginning.

func (*Service) Routes

func (s *Service) Routes(pattern string, r chi.Router)

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Service) SetServiceBuilder

func (s *Service) SetServiceBuilder(b *domain.ServiceBuilder)

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

func (*Service) StartHarvestSync

func (s *Service) StartHarvestSync() error

Jump to

Keyboard shortcuts

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