ead

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: 33 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"
	StateCanceled                              = "canceled processing"
	StateFinished                              = "finished processing EAD"
	StateDeleted                               = "deleted EAD"
)
View Source
const (
	PaccessKey = "processAccessTime"
)

Variables

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

Functions

func Process added in v0.3.0

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

Types

type CreateTreeFn

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

type DaoFn added in v0.2.0

type DaoFn func(cfg *eadHub3.DaoConfig) error

type EADHarvester added in v0.2.0

type EADHarvester struct {
	OrgID string
	// contains filtered or unexported fields
}

func NewEADHarvester added in v0.2.0

func NewEADHarvester(s *Service) (EADHarvester, error)

func (*EADHarvester) ProcessEadFromOai added in v0.2.0

func (e *EADHarvester) ProcessEadFromOai(r *oai.Response)

type Meta

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

func (*Meta) GetSourcePath added in v0.3.0

func (m *Meta) GetSourcePath() string

GetSourcePath returns full path to the source EAD file

type Metrics

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

func (*Metrics) IncAlreadyQueued added in v0.2.0

func (m *Metrics) IncAlreadyQueued()

func (*Metrics) IncCancelled added in v0.2.0

func (m *Metrics) IncCancelled()

func (*Metrics) IncFailed added in v0.2.0

func (m *Metrics) IncFailed()

func (*Metrics) IncFinished added in v0.2.0

func (m *Metrics) IncFinished()

func (*Metrics) IncStarted added in v0.2.0

func (m *Metrics) IncStarted()

func (*Metrics) IncSubmitted added in v0.2.0

func (m *Metrics) IncSubmitted()

type MetsHarvester added in v0.2.0

type MetsHarvester struct {
	OrgID string
	// contains filtered or unexported fields
}

func NewMetsHarvest added in v0.2.0

func NewMetsHarvest(c *ead.DaoClient) (MetsHarvester, error)

func (*MetsHarvester) ProcessMetsFromOai added in v0.2.0

func (m *MetsHarvester) ProcessMetsFromOai(r *oai.Response)

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 SetProcessDigital added in v0.2.0

func SetProcessDigital(isEnabled bool) Option

func SetProcessDigitalIfMissing added in v0.2.1

func SetProcessDigitalIfMissing(isEnabled bool) Option

func SetWorkers added in v0.1.10

func SetWorkers(workers int) Option

type PreStoreFn added in v0.2.1

type PreStoreFn func(b []byte) []byte

type ProcessFn added in v0.3.0

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

type ProcessingState

type ProcessingState string

type Service

type Service struct {
	M            Metrics
	CreateTreeFn CreateTreeFn
	PreStoreFn   PreStoreFn
	DaoFn        DaoFn
	ProcessFn    ProcessFn
	DaoClient    *eadHub3.DaoClient
	// contains filtered or unexported fields
}

func NewService

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

func (*Service) AddPostHook added in v0.2.0

func (s *Service) AddPostHook(hook domain.PostHookService) error

AddPostHook adds posthook to the EAD service

func (*Service) CancelTask

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

func (*Service) ClearRestrictions added in v0.2.0

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

Call this function each night at 00:01 in a cron job to check and clear tree node restrictions.

func (*Service) CreateTask added in v0.2.0

func (s *Service) CreateTask(r *http.Request, meta Meta) (*taskResponse, error)

func (*Service) DeleteEAD added in v0.2.0

func (s *Service) DeleteEAD(datasetID, orgID string) error

DeleteEAD removes the dataset from the store.

func (*Service) GetName

func (s *Service) GetName(b []byte) (string, error)

func (*Service) GetTask

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

func (*Service) LoadEAD added in v0.2.0

func (s *Service) LoadEAD(orgID, spec string) (Meta, error)

func (*Service) LoadModifiedEADDate added in v0.2.0

func (s *Service) LoadModifiedEADDate(spec string) time.Time

LoadModifiedEADDate loads the modified date of the EAD or else zero time if not available.

func (*Service) Metrics

func (s *Service) Metrics() Metrics

func (*Service) NewTask

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

func (*Service) Publish added in v0.3.0

func (s *Service) Publish(ctx context.Context, messages ...*domainpb.IndexMessage) error

func (*Service) ResyncCacheDir added in v0.2.0

func (s *Service) ResyncCacheDir(orgID string) error

func (*Service) Routes added in v0.2.0

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

func (*Service) SaveEAD

func (s *Service) SaveEAD(r io.Reader, size int64, datasetID, orgID string) (Meta, error)

SaveEAD stores the source EAD in the revision store

func (*Service) SaveModifiedEADDate added in v0.2.0

func (s *Service) SaveModifiedEADDate(spec, modified string) error

SaveModifiedEADDate stores the modified EAD date.

func (*Service) ServeHTTP added in v0.3.0

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

func (*Service) SetServiceBuilder added in v0.3.0

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

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