ead

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateSubmitted             ProcessingState = "submitted source EAD"
	StatePending                               = "pending processing"
	StateStarted                               = "started processing"
	StateProcessingDescription                 = "processing description"
	StateProcessingMetsFiles                   = "processing METS files"
	StateProcessingInventories                 = "processing and indexing inventories"
	StateInError                               = "stopped processing with error"
	StateCancelled                             = "cancelled processing"
	StateFinished                              = "finished processing EAD"
)

Variables

View Source
var (
	ErrTaskNotFound         = errors.New("task not found")
	ErrTaskAlreadySubmitted = errors.New("task already submitted")
)

Functions

This section is empty.

Types

type CreateTreeFn

type CreateTreeFn func(cfg *eadHub3.NodeConfig, n *eadHub3.Node, hubID string, id string) *fragments.Tree

type Meta

type Meta struct {
	OrgID                 string
	DatasetID             string
	Title                 string
	Clevels               uint64
	DaoLinks              uint64
	DaoErrors             uint64
	DaoErrorLinks         []string
	Tags                  []string
	RecordsPublished      uint64
	DigitalObjects        uint64
	FileSize              uint64
	Created               bool
	ProcessingDuration    time.Duration `json:"processingDuration,omitempty"`
	ProcessingDurationFmt string        `json:"processingDurationFmt,omitempty"`
	// contains filtered or unexported fields
}

type Metrics

type Metrics struct {
	Submitted     uint64
	Started       uint64
	Failed        uint64
	Finished      uint64
	Canceled      uint64
	AlreadyQueued uint64
}

type Option

type Option func(*Service) error

func SetCreateTree

func SetCreateTree(fn CreateTreeFn) Option

func SetDataDir

func SetDataDir(path string) Option

func SetIndexService

func SetIndexService(is *index.Service) Option

func SetWorkers added in v0.1.10

func SetWorkers(workers int) Option

type ProcessingState

type ProcessingState string

type Service

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

func NewService

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

func (*Service) CancelTask

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

func (*Service) GetName

func (s *Service) GetName(buf *bytes.Buffer) (string, error)

func (*Service) GetTask

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

func (*Service) Metrics

func (s *Service) Metrics() Metrics

func (*Service) NewTask

func (s *Service) NewTask(meta *Meta) (*Task, error)

func (*Service) Process

func (s *Service) Process(parentCtx context.Context, t *Task) error

func (*Service) SaveEAD

func (s *Service) SaveEAD(r io.Reader, size int64) (*bytes.Buffer, Meta, error)

func (*Service) Shutdown

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

func (*Service) StartWorkers

func (s *Service) StartWorkers() error

func (*Service) Tasks

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

func (*Service) Upload

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

type Task

type Task struct {
	ID          string `json:"id"`
	Meta        *Meta
	InState     ProcessingState `json:"inState"`
	ErrorMsg    string          `json:"errorMsg"`
	Transitions []*Transition   `json:"transitions"`
	Interrupted bool
	// contains filtered or unexported fields
}

func (*Task) Next

func (t *Task) Next()

type Transition

type Transition struct {
	State       ProcessingState   `json:"state"`
	Started     time.Time         `json:"started"`
	Finished    time.Time         `json:"finished"`
	Metrics     map[string]uint64 `json:"metrics,omitempty"`
	Duration    time.Duration     `json:"duration"`
	DurationFmt string            `json:"durationFmt"`
}

Jump to

Keyboard shortcuts

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