fair

package
v2.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 32 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIdentifier = errors.New("invalid identifier")

Functions

func ARKBeautifier added in v2.0.13

func ARKBeautifier(ark string) string

func ArkParts added in v2.0.10

func ArkParts(pid string) (naan, qualifier, component, variant, inflection string, err error)

func UniqString added in v2.0.6

func UniqString(arr []string) []string

Types

type ARKConfig added in v2.0.10

type ARKConfig struct {
	NAAN     string
	Shoulder string
	Prefix   string
}

type ARKService added in v2.0.10

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

func NewARKService added in v2.0.10

func NewARKService(mr *MultiResolver, config *ARKConfig, logger zLogger.ZLogger) (*ARKService, error)

func (*ARKService) AddPlugin added in v2.0.10

func (srv *ARKService) AddPlugin(repository string, plugin Plugin)

func (*ARKService) CreatePID added in v2.0.10

func (srv *ARKService) CreatePID(fair *Fair, item *ItemData) (string, error)

func (*ARKService) Resolve added in v2.0.10

func (srv *ARKService) Resolve(pid string) (string, ResolveResultType, error)

func (*ARKService) Type added in v2.0.10

func (*ARKService) Unify added in v2.0.10

func (srv *ARKService) Unify(ark string) (string, error)

type Archive added in v2.0.6

type Archive struct {
	Name         string
	CreationDate time.Time
	LastVersion  int64
	Description  string
}

type ArchiveItem added in v2.0.6

type ArchiveItem struct {
	ItemData
	NewFiles []string
}

type ArkPluginResultType added in v2.0.10

type ArkPluginResultType uint
const (
	ARKPluginCannotHandle ArkPluginResultType = iota
	ARKPluginData
	ARKPluginRedirect
)

type DataAccess

type DataAccess string
const (
	DataAccessPublic     DataAccess = "public"
	DataAccessClosed     DataAccess = "closed"
	DataAccessClosedData DataAccess = "closed_data"
	DataAccessOpenAccess DataAccess = "open_access"
)

type DataStatus

type DataStatus string
const (
	DataStatusActive      DataStatus = "active"
	DataStatusDisabled    DataStatus = "disabled"
	DataStatusDeleted     DataStatus = "deleted"
	DataStatusDeletedMeta DataStatus = "deleted_meta"
)

type DataciteConfig added in v2.0.10

type DataciteConfig struct {
	Api      string
	User     string
	Password string
	Prefix   string
}

type DataciteService added in v2.0.10

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

func NewDataciteService added in v2.0.10

func NewDataciteService(mr *MultiResolver, config DataciteConfig, logger zLogger.ZLogger) (*DataciteService, error)

func (*DataciteService) CreatePID added in v2.0.10

func (srv *DataciteService) CreatePID(fair *Fair, item *ItemData) (string, error)

func (*DataciteService) Resolve added in v2.0.10

func (srv *DataciteService) Resolve(pid string) (string, ResolveResultType, error)

func (*DataciteService) Type added in v2.0.10

type Fair

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

func NewFair

func NewFair(db *pgxpool.Pool, dbSchema string, log zLogger.ZLogger) (*Fair, error)

func (*Fair) AbortUpdate

func (f *Fair) AbortUpdate(p *Partition, source string) error

func (*Fair) AddArchive added in v2.0.6

func (f *Fair) AddArchive(part *Partition, name, description string) error

func (*Fair) AddArchiveItem added in v2.0.6

func (f *Fair) AddArchiveItem(part *Partition, archive string, item *ItemData) error

func (*Fair) AddPartition

func (f *Fair) AddPartition(p *Partition)

func (*Fair) CreateItem

func (f *Fair) CreateItem(partition *Partition, data *ItemData) (*ItemData, error)

func (*Fair) DeleteItem

func (f *Fair) DeleteItem(partition *Partition, uuidStr string) error

func (*Fair) EndUpdate

func (f *Fair) EndUpdate(p *Partition, source string) error

func (*Fair) GetArchive added in v2.0.7

func (f *Fair) GetArchive(part *Partition, name string) (*Archive, error)

func (*Fair) GetArchiveItems added in v2.0.6

func (f *Fair) GetArchiveItems(part *Partition, archive string, delta bool, fn func(item *ArchiveItem) error) error

func (*Fair) GetDB added in v2.0.10

func (f *Fair) GetDB() *pgxpool.Pool

func (*Fair) GetItem

func (f *Fair) GetItem(partition *Partition, uuidStr string) (*ItemData, error)

func (*Fair) GetItemSource

func (f *Fair) GetItemSource(partition *Partition, sourceid int64, signature string) (*ItemData, error)

func (*Fair) GetItemsDatestamp

func (f *Fair) GetItemsDatestamp(partition *Partition, datestamp, until time.Time, set string, access []DataAccess, limit, offset int64, completeListSize *int64, fn func(item *ItemData) error) error

func (*Fair) GetItemsSeq

func (f *Fair) GetItemsSeq(partition *Partition, seq int64, until time.Time, access []DataAccess, limit, offset int64, completeListSize *int64, fn func(item *ItemData) error) error

func (*Fair) GetMinimumDatestamp

func (f *Fair) GetMinimumDatestamp(partition *Partition) (time.Time, error)

func (*Fair) GetOriginalData added in v2.0.4

func (f *Fair) GetOriginalData(p *Partition, uuid string) ([]byte, string, error)

func (*Fair) GetPartition

func (f *Fair) GetPartition(name string) (*Partition, error)

func (*Fair) GetPartitions

func (f *Fair) GetPartitions() map[string]*Partition

func (*Fair) GetSets

func (f *Fair) GetSets(p *Partition) (map[string]string, error)

func (*Fair) GetSourceById

func (f *Fair) GetSourceById(partition *Partition, id int64) (*Source, error)

func (*Fair) GetSourceByName

func (f *Fair) GetSourceByName(pName string, name string) (*Source, error)

func (*Fair) GetSourceByOAIDomain

func (f *Fair) GetSourceByOAIDomain(name string) (*Source, error)

func (*Fair) LoadSources

func (f *Fair) LoadSources() error

func (*Fair) NextCounter added in v2.0.10

func (f *Fair) NextCounter(name string) (int64, error)

func (*Fair) RefreshSearch

func (f *Fair) RefreshSearch() error

func (*Fair) Resolve added in v2.0.10

func (f *Fair) Resolve(pid string) (data string, resultType ResolveResultType, err error)

func (*Fair) Search

func (f *Fair) Search(p *Partition, dtr *datatable.Request) ([]map[string]string, int64, int64, error)

func (*Fair) SetOriginalData added in v2.0.4

func (f *Fair) SetOriginalData(p *Partition, uuid string, format string, data []byte) error

func (*Fair) SetSource added in v2.0.5

func (f *Fair) SetSource(src *Source) error

func (*Fair) StartUpdate

func (f *Fair) StartUpdate(p *Partition, source string) error

type HandleConfig added in v2.0.10

type HandleConfig struct {
	ServiceName    string
	Addr           string
	JWTKey         string
	JWTAlg         string
	SkipCertVerify bool
	ID             string
	Prefix         string
}

type HandleService added in v2.0.10

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

func NewHandleService added in v2.0.10

func NewHandleService(mr *MultiResolver, config *HandleConfig, logger zLogger.ZLogger) (*HandleService, error)

func (*HandleService) CreatePID added in v2.0.10

func (srv *HandleService) CreatePID(fair *Fair, item *ItemData) (string, error)

func (*HandleService) Resolve added in v2.0.10

func (srv *HandleService) Resolve(pid string) (string, ResolveResultType, error)

func (*HandleService) Type added in v2.0.10

type ItemData

type ItemData struct {
	Source     string      `json:"source"`
	Partition  string      `json:"partition"`
	Signature  string      `json:"signature"`
	Metadata   myfair.Core `json:"metadata"`
	Set        []string    `json:"set"`
	Catalog    []string    `json:"catalog"`
	Identifier []string    `json:"identifier"`
	Access     DataAccess  `json:"access"`
	Status     DataStatus  `json:"status"`
	Seq        int64       `json:"-"`
	UUID       string      `json:"uuid"`
	Datestamp  time.Time   `json:"datestamp"`
	URL        string
}

type MultiResolver added in v2.0.10

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

func NewResolver added in v2.0.10

func NewResolver(part *Partition, logger zLogger.ZLogger) (*MultiResolver, error)

func (*MultiResolver) AddResolver added in v2.0.10

func (mr *MultiResolver) AddResolver(resolver Resolver)

func (*MultiResolver) CreateAll added in v2.0.10

func (*MultiResolver) CreatePID added in v2.0.10

func (mr *MultiResolver) CreatePID(uuid string, part *Partition, identifierType dataciteModel.RelatedIdentifierType) (string, error)

func (*MultiResolver) GetPartition added in v2.0.10

func (mr *MultiResolver) GetPartition() *Partition

func (*MultiResolver) InitPIDTable added in v2.0.10

func (mr *MultiResolver) InitPIDTable() error

func (*MultiResolver) Resolve added in v2.0.10

func (mr *MultiResolver) Resolve(pid string) (data string, resultType ResolveResultType, err error)

func (*MultiResolver) StorePID added in v2.0.10

func (mr *MultiResolver) StorePID(uuid string, identifierType dataciteModel.RelatedIdentifierType, identifier string) error

type OAIConfig added in v2.0.10

type OAIConfig struct {
	RepositoryName         string
	AdminEmail             []string
	SampleIdentifier       string
	Delimiter              string
	Scheme                 string
	PageSize               int64
	ResumptionTokenTimeout time.Duration
}

type Partition

type Partition struct {
	Name         string
	AddrExt      string
	Description  string
	JWTKey       string
	JWTAlg       []string
	Domain       string
	HandlePrefix string
	OAI          *OAIConfig
	// contains filtered or unexported fields
}

func NewPartition

func NewPartition(_fair *Fair, Name, AddrExt, Domain string, oai *OAIConfig, Description, JWTKey string, JWTAlg []string, logger zLogger.ZLogger) (*Partition, error)

func (*Partition) AddResolver added in v2.0.10

func (p *Partition) AddResolver(mr *MultiResolver)

func (*Partition) CreatePID added in v2.0.10

func (p *Partition) CreatePID(uuid string, identifierType dataciteModel.RelatedIdentifierType) (string, error)

func (*Partition) GetFair added in v2.0.10

func (p *Partition) GetFair() *Fair

func (*Partition) GetMultiResolver added in v2.0.10

func (p *Partition) GetMultiResolver() *MultiResolver

func (*Partition) RedirURL added in v2.0.10

func (p *Partition) RedirURL(uuid string) string

func (*Partition) Resolve added in v2.0.10

func (p *Partition) Resolve(pid string) (string, ResolveResultType, error)

type Plugin added in v2.0.10

type Plugin interface {
	Handle(fair *Fair, pid string, item *ItemData) (*PluginResult, error)
}

type PluginResult added in v2.0.10

type PluginResult struct {
	Type ArkPluginResultType
	Data []byte
	Mime string
}

type ResolveResultType added in v2.0.10

type ResolveResultType uint32
const (
	ResolveResultTypeUnknown ResolveResultType = iota
	ResolveResultTypeRedirect
	ResolveResultTypeTextHTML
	ResolveResultTypeTextPlain
	ResolveResultTypeApplicationJSON
	ResolveResultTypeApplicationYAML
	ResolveResultTypeApplicationXML
)

type Resolver added in v2.0.10

type Resolver interface {
	ResolverResolve
	Type() dataciteModel.RelatedIdentifierType
	//Unify(ark string) (string, error)
	CreatePID(fair *Fair, item *ItemData) (string, error)
}

type ResolverResolve added in v2.0.10

type ResolverResolve interface {
	Resolve(pid string) (string, ResolveResultType, error)
}

type Source

type Source struct {
	ID          int64
	Name        string
	DetailURL   string
	Description string
	OAIDomain   string
	Partition   string
	Repository  string
}

type SourceData

type SourceData struct {
	Source string `json:"source"`
}

Jump to

Keyboard shortcuts

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