backends

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MissingValue = "missing"

Variables

This section is empty.

Functions

func NewDummyOrganization

func NewDummyOrganization(id string) *models.Organization

TODO remove this when we always have an uptodate db of organizations

func NewDummyPerson

func NewDummyPerson(id string) *models.Person

func NewDummyProject

func NewDummyProject(id string) *models.Project

Types

type BulkIndexer

type BulkIndexer[T any] interface {
	Index(context.Context, T) error
	Close(context.Context) error
}

type BulkIndexerConfig

type BulkIndexerConfig struct {
	OnError      func(error)
	OnIndexError func(string, error)
}

type DatasetGetter

type DatasetGetter interface {
	GetDataset(string) (*models.Dataset, error)
}

type DatasetIDIndex

type DatasetIDIndex interface {
	Search(*models.SearchArgs) (*models.SearchHits, error)
	Each(searchArgs *models.SearchArgs, maxSize int, cb func(string)) error
	Delete(id string) error
	DeleteAll() error
	WithScope(string, ...string) DatasetIDIndex
}

type DatasetIndex

type DatasetIndex interface {
	Search(*models.SearchArgs) (*models.DatasetHits, error)
	Each(searchArgs *models.SearchArgs, maxSize int, cb func(*models.Dataset)) error
	Delete(id string) error
	DeleteAll() error
	WithScope(string, ...string) DatasetIndex
}

func NewDatasetIndex

func NewDatasetIndex(di DatasetIDIndex, r *repositories.Repo) DatasetIndex

type DatasetListExporter

type DatasetListExporter interface {
	GetContentType() string
	Add(*models.Dataset)
	Flush() error
}

type DatasetListExporterFactory

type DatasetListExporterFactory func(io.Writer) DatasetListExporter

type FileStore

type FileStore interface {
	Exists(context.Context, string) (bool, error)
	Get(context.Context, string) (io.ReadCloser, error)
	Add(context.Context, io.Reader, string) (string, error)
	Delete(context.Context, string) error
	DeleteAll(context.Context) error
}

type HandleService

type HandleService interface {
	UpsertHandle(string) (*models.Handle, error)
}

type IndexSwitcher

type IndexSwitcher[T any] interface {
	Index(context.Context, T) error
	Switch(context.Context) error
}

type LicenseSearchService

type LicenseSearchService interface {
	IndexAll() error
	SuggestLicenses(string) ([]models.Completion, error)
}

type MediaTypeSearchService

type MediaTypeSearchService interface {
	IndexAll() error
	SuggestMediaTypes(string) ([]models.Completion, error)
}

type OrganizationSearchService

type OrganizationSearchService interface {
	SuggestOrganizations(string) ([]models.Completion, error)
}

type OrganizationService

type OrganizationService interface {
	GetOrganization(string) (*models.Organization, error)
}

type PersonSearchService

type PersonSearchService interface {
	SuggestPeople(string) ([]*models.Person, error)
}

type PersonService

type PersonService interface {
	GetPerson(string) (*models.Person, error)
}

type PersonWithOrganizationsService

type PersonWithOrganizationsService struct {
	PersonService       PersonService
	OrganizationService OrganizationService
}

func (*PersonWithOrganizationsService) GetPerson

type ProjectSearchService

type ProjectSearchService interface {
	SuggestProjects(string) ([]models.Completion, error)
}

type ProjectService

type ProjectService interface {
	GetProject(string) (*models.Project, error)
}

type PublicationDecoder

type PublicationDecoder interface {
	Decode(*models.Publication) error
}

type PublicationDecoderFactory

type PublicationDecoderFactory func(io.Reader) PublicationDecoder

type PublicationEncoder

type PublicationEncoder func(*models.Publication) ([]byte, error)

type PublicationGetter

type PublicationGetter interface {
	GetPublication(string) (*models.Publication, error)
}

type PublicationIDIndex

type PublicationIDIndex interface {
	Search(*models.SearchArgs) (*models.SearchHits, error)
	Each(searchArgs *models.SearchArgs, maxSize int, cb func(string)) error
	Delete(id string) error
	DeleteAll() error
	WithScope(string, ...string) PublicationIDIndex
}

type PublicationIndex

type PublicationIndex interface {
	Search(*models.SearchArgs) (*models.PublicationHits, error)
	Each(searchArgs *models.SearchArgs, maxSize int, cb func(*models.Publication)) error
	Delete(id string) error
	DeleteAll() error
	WithScope(string, ...string) PublicationIndex
}

type PublicationListExporter

type PublicationListExporter interface {
	GetContentType() string
	Add(*models.Publication)
	Flush() error
}

type PublicationListExporterFactory

type PublicationListExporterFactory func(io.Writer) PublicationListExporter

type SearchService

type SearchService interface {
	NewDatasetIndex(*repositories.Repo) DatasetIndex
	NewDatasetBulkIndexer(BulkIndexerConfig) (BulkIndexer[*models.Dataset], error)
	NewDatasetIndexSwitcher(BulkIndexerConfig) (IndexSwitcher[*models.Dataset], error)
	NewPublicationIndex(*repositories.Repo) PublicationIndex
	NewPublicationBulkIndexer(BulkIndexerConfig) (BulkIndexer[*models.Publication], error)
	NewPublicationIndexSwitcher(BulkIndexerConfig) (IndexSwitcher[*models.Publication], error)
}

type Services

type Services struct {
	ORCIDSandbox              bool
	ORCIDClient               *orcid.MemberClient
	Repo                      *repositories.Repo
	FileStore                 FileStore
	SearchService             SearchService
	DatasetSearchIndex        DatasetIndex
	PublicationSearchIndex    PublicationIndex
	OrganizationService       OrganizationService
	PersonService             PersonService
	ProjectService            ProjectService
	UserService               UserService
	OrganizationSearchService OrganizationSearchService
	PersonSearchService       PersonSearchService
	ProjectSearchService      ProjectSearchService
	UserSearchService         UserSearchService
	LicenseSearchService      LicenseSearchService
	MediaTypeSearchService    MediaTypeSearchService
	PublicationSources        map[string]PublicationGetter
	DatasetSources            map[string]DatasetGetter
	PublicationEncoders       map[string]PublicationEncoder
	PublicationDecoders       map[string]PublicationDecoderFactory
	PublicationListExporters  map[string]PublicationListExporterFactory
	DatasetListExporters      map[string]DatasetListExporterFactory
	HandleService             HandleService
}

type UserSearchService

type UserSearchService interface {
	SuggestUsers(string) ([]*models.Person, error)
}

type UserService

type UserService interface {
	GetUser(string) (*models.Person, error)
	GetUserByUsername(string) (*models.Person, error)
}

type UserWithOrganizationsService

type UserWithOrganizationsService struct {
	UserService         UserService
	OrganizationService OrganizationService
}

func (*UserWithOrganizationsService) GetUser

func (*UserWithOrganizationsService) GetUserByUsername

func (s *UserWithOrganizationsService) GetUserByUsername(username string) (*models.Person, error)

Directories

Path Synopsis
TODO use fs.FS
TODO use fs.FS

Jump to

Keyboard shortcuts

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